]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu/userq: Do not allow userspace to trivially triger kernel warnings
authorTvrtko Ursulin <tvrtko.ursulin@igalia.com>
Mon, 23 Feb 2026 12:41:31 +0000 (12:41 +0000)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 25 Feb 2026 21:27:42 +0000 (16:27 -0500)
Userspace can either deliberately pass in the too small num_fences, or the
required number can legitimately grow between the two calls to the userq
wait ioctl. In both cases we do not want the emit the kernel warning
backtrace since nothing is wrong with the kernel and userspace will simply
get an errno reported back. So lets simply drop the WARN_ONs.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Fixes: a292fdecd728 ("drm/amdgpu: Implement userqueue signal/wait IOCTL")
Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c

index 6ea612adfc37568767655bd6397bf3521f3c8ede..921e583b8d2ea203c07cc2961a13dae2a9d925ae 100644 (file)
@@ -834,7 +834,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data,
 
                        dma_resv_for_each_fence(&resv_cursor, gobj_read[i]->resv,
                                                DMA_RESV_USAGE_READ, fence) {
-                               if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) {
+                               if (num_fences >= wait_info->num_fences) {
                                        r = -EINVAL;
                                        goto free_fences;
                                }
@@ -851,7 +851,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data,
 
                        dma_resv_for_each_fence(&resv_cursor, gobj_write[i]->resv,
                                                DMA_RESV_USAGE_WRITE, fence) {
-                               if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) {
+                               if (num_fences >= wait_info->num_fences) {
                                        r = -EINVAL;
                                        goto free_fences;
                                }
@@ -875,7 +875,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data,
                                        goto free_fences;
 
                                dma_fence_unwrap_for_each(f, &iter, fence) {
-                                       if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) {
+                                       if (num_fences >= wait_info->num_fences) {
                                                r = -EINVAL;
                                                dma_fence_put(fence);
                                                goto free_fences;
@@ -900,7 +900,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data,
                        if (r)
                                goto free_fences;
 
-                       if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) {
+                       if (num_fences >= wait_info->num_fences) {
                                r = -EINVAL;
                                dma_fence_put(fence);
                                goto free_fences;