Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

amdkfd: find kfd_process by filep->private_data in kfd_mmap

This commit finds the proper kfd_process by
filep->private_data in kfd_mmap,
because the function kfd_get_process()
can not locate a specific kfd process among
multiple contexts.

Signed-off-by: Zhu Lingshan <lingshan.zhu@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Zhu Lingshan and committed by
Alex Deucher
4eb38fc0 fac682a1

+7 -4
+7 -4
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
··· 3414 3414 } 3415 3415 3416 3416 3417 - static int kfd_mmap(struct file *filp, struct vm_area_struct *vma) 3417 + static int kfd_mmap(struct file *filep, struct vm_area_struct *vma) 3418 3418 { 3419 3419 struct kfd_process *process; 3420 3420 struct kfd_node *dev = NULL; 3421 3421 unsigned long mmap_offset; 3422 3422 unsigned int gpu_id; 3423 3423 3424 - process = kfd_get_process(current); 3425 - if (IS_ERR(process)) 3426 - return PTR_ERR(process); 3424 + process = filep->private_data; 3425 + if (!process) 3426 + return -ESRCH; 3427 + 3428 + if (process->lead_thread != current->group_leader) 3429 + return -EBADF; 3427 3430 3428 3431 mmap_offset = vma->vm_pgoff << PAGE_SHIFT; 3429 3432 gpu_id = KFD_MMAP_GET_GPU_ID(mmap_offset);