]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amdkfd: Improve kfd_process lookup in kfd_ioctl
authorFelix Kuehling <Felix.Kuehling@amd.com>
Thu, 5 Dec 2019 02:23:08 +0000 (21:23 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 9 Jan 2020 21:08:19 +0000 (16:08 -0500)
commit196eb212511a0b6574bfef55a2cbc39c72591ab5
treeeeaa5e9705a701ac6e665860383950c8d734f605
parent4c07ccc7d3f4dca4dc22067dde86887749b22c2c
drm/amdkfd: Improve kfd_process lookup in kfd_ioctl

Use filep->private_data to store a pointer to the kfd_process data
structure. Take an extra reference for that, which gets released in
the kfd_release callback. Check that the process calling kfd_ioctl
is the same that opened the file descriptor. Return -EBADF if it's
not, so that this error can be distinguished in user mode.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
drivers/gpu/drm/amd/amdkfd/kfd_process.c