From 39e27f1f3478887738ff39db201f99b1b01ba06a Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 4 Mar 2024 02:05:20 +0000 Subject: [PATCH] drm/amdkfd: Use correct drm device for cgroup permission check From Mukul Joshi 5a1bd2143fd70f35a255c02611731b509d1cebac in linux-6.6.y/6.6.19 4119734e06a7f30e7e8eb666692a58b85dca0269 in mainline linux --- sys/dev/pci/drm/amd/amdkfd/kfd_priv.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_priv.h b/sys/dev/pci/drm/amd/amdkfd/kfd_priv.h index 3287a396139..12ee273e87e 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_priv.h +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_priv.h @@ -1482,10 +1482,15 @@ void kfd_dec_compute_active(struct kfd_node *dev); /* Cgroup Support */ /* Check with device cgroup if @kfd device is accessible */ -static inline int kfd_devcgroup_check_permission(struct kfd_node *kfd) +static inline int kfd_devcgroup_check_permission(struct kfd_node *node) { #if defined(CONFIG_CGROUP_DEVICE) || defined(CONFIG_CGROUP_BPF) - struct drm_device *ddev = adev_to_drm(kfd->adev); + struct drm_device *ddev; + + if (node->xcp) + ddev = node->xcp->ddev; + else + ddev = adev_to_drm(node->adev); return devcgroup_check_permission(DEVCG_DEV_CHAR, DRM_MAJOR, ddev->render->index, -- 2.20.1