Skip to content

Commit 7b7d769

Browse files
Tvrtko Ursulinalexdeucher
authored andcommitted
drm/amdgpu/userq: Do not allow userspace to trivially triger kernel warnings
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: a292fde ("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> (cherry picked from commit 2c333ea)
1 parent 49abfa8 commit 7b7d769

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data,
833833

834834
dma_resv_for_each_fence(&resv_cursor, gobj_read[i]->resv,
835835
DMA_RESV_USAGE_READ, fence) {
836-
if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) {
836+
if (num_fences >= wait_info->num_fences) {
837837
r = -EINVAL;
838838
goto free_fences;
839839
}
@@ -850,7 +850,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data,
850850

851851
dma_resv_for_each_fence(&resv_cursor, gobj_write[i]->resv,
852852
DMA_RESV_USAGE_WRITE, fence) {
853-
if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) {
853+
if (num_fences >= wait_info->num_fences) {
854854
r = -EINVAL;
855855
goto free_fences;
856856
}
@@ -874,7 +874,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data,
874874
goto free_fences;
875875

876876
dma_fence_unwrap_for_each(f, &iter, fence) {
877-
if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) {
877+
if (num_fences >= wait_info->num_fences) {
878878
r = -EINVAL;
879879
dma_fence_put(fence);
880880
goto free_fences;
@@ -899,7 +899,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data,
899899
if (r)
900900
goto free_fences;
901901

902-
if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) {
902+
if (num_fences >= wait_info->num_fences) {
903903
r = -EINVAL;
904904
dma_fence_put(fence);
905905
goto free_fences;

0 commit comments

Comments
 (0)