Skip to content

Commit 9d7993a

Browse files
mukjoshialexdeucher
authored andcommitted
drm/amdkfd: Check cgroup when returning DMABuf info
Check cgroup permissions when returning DMA-buf info and based on cgroup info return the GPU id of the GPU that have access to the BO. Signed-off-by: Mukul Joshi <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 075ec16 commit 9d7993a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_chardev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep,
15231523

15241524
/* Find a KFD GPU device that supports the get_dmabuf_info query */
15251525
for (i = 0; kfd_topology_enum_kfd_devices(i, &dev) == 0; i++)
1526-
if (dev)
1526+
if (dev && !kfd_devcgroup_check_permission(dev))
15271527
break;
15281528
if (!dev)
15291529
return -EINVAL;
@@ -1545,7 +1545,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep,
15451545
if (xcp_id >= 0)
15461546
args->gpu_id = dmabuf_adev->kfd.dev->nodes[xcp_id]->id;
15471547
else
1548-
args->gpu_id = dmabuf_adev->kfd.dev->nodes[0]->id;
1548+
args->gpu_id = dev->id;
15491549
args->flags = flags;
15501550

15511551
/* Copy metadata buffer to user mode */

0 commit comments

Comments
 (0)