Commit 9d7993a7 authored by Mukul Joshi's avatar Mukul Joshi Committed by Alex Deucher

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: default avatarMukul Joshi <mukul.joshi@amd.com>
Reviewed-by: default avatarFelix Kuehling <felix.kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 075ec164
...@@ -1523,7 +1523,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep, ...@@ -1523,7 +1523,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep,
/* Find a KFD GPU device that supports the get_dmabuf_info query */ /* Find a KFD GPU device that supports the get_dmabuf_info query */
for (i = 0; kfd_topology_enum_kfd_devices(i, &dev) == 0; i++) for (i = 0; kfd_topology_enum_kfd_devices(i, &dev) == 0; i++)
if (dev) if (dev && !kfd_devcgroup_check_permission(dev))
break; break;
if (!dev) if (!dev)
return -EINVAL; return -EINVAL;
...@@ -1545,7 +1545,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep, ...@@ -1545,7 +1545,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep,
if (xcp_id >= 0) if (xcp_id >= 0)
args->gpu_id = dmabuf_adev->kfd.dev->nodes[xcp_id]->id; args->gpu_id = dmabuf_adev->kfd.dev->nodes[xcp_id]->id;
else else
args->gpu_id = dmabuf_adev->kfd.dev->nodes[0]->id; args->gpu_id = dev->id;
args->flags = flags; args->flags = flags;
/* Copy metadata buffer to user mode */ /* Copy metadata buffer to user mode */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment