drm/amdkfd: Check cgroup when returning DMABuf info
authorjsg <jsg@openbsd.org>
Mon, 20 May 2024 04:50:56 +0000 (04:50 +0000)
committerjsg <jsg@openbsd.org>
Mon, 20 May 2024 04:50:56 +0000 (04:50 +0000)
From Mukul Joshi
d644962423704441713be6669b9544beed5d4176 in linux-6.6.y/6.6.31
9d7993a7ab9651afd5fb295a4992e511b2b727aa in mainline linux

sys/dev/pci/drm/amd/amdkfd/kfd_chardev.c

index 4fbdc94..f22b4cd 100644 (file)
@@ -1516,7 +1516,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep,
 
        /* Find a KFD GPU device that supports the get_dmabuf_info query */
        for (i = 0; kfd_topology_enum_kfd_devices(i, &dev) == 0; i++)
-               if (dev)
+               if (dev && !kfd_devcgroup_check_permission(dev))
                        break;
        if (!dev)
                return -EINVAL;
@@ -1538,7 +1538,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep,
        if (xcp_id >= 0)
                args->gpu_id = dmabuf_adev->kfd.dev->nodes[xcp_id]->id;
        else
-               args->gpu_id = dmabuf_adev->kfd.dev->nodes[0]->id;
+               args->gpu_id = dev->id;
        args->flags = flags;
 
        /* Copy metadata buffer to user mode */