[PATCH v2] drm/amdgpu: Add NULL ptr check for non userq fences

Arunpravin Paneer Selvam Arunpravin.PaneerSelvam at amd.com
Thu Nov 14 05:49:17 UTC 2024


We are observing a NULL value in the non userq fences,
thus added a NULL pointer check just to avoid the
NULL pointer dereference crash.

v2: Moved the NULL check above the non userq check.

Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
index 6157a540c929..76f7babd7a54 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
@@ -815,6 +815,9 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data,
 			struct amdgpu_userq_fence *userq_fence;
 			u32 index;
 
+			if (!fences[i])
+				continue;
+
 			userq_fence = to_amdgpu_userq_fence(fences[i]);
 			if (!userq_fence) {
 				/*
-- 
2.25.1



More information about the amd-gfx mailing list