Skip to content

Commit 7321302

Browse files
Tvrtko UrsulinSasha Levin
authored andcommitted
drm/amdgpu/userq: Do not allow userspace to trivially triger kernel warnings
[ Upstream commit 7b7d769 ] 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 2c333ea579de6cc20ea7bc50e9595ef72863e65c) Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent eaa6a56 commit 7321302

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

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

831831
dma_resv_for_each_fence(&resv_cursor, gobj_read[i]->resv,
832832
DMA_RESV_USAGE_READ, fence) {
833-
if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) {
833+
if (num_fences >= wait_info->num_fences) {
834834
r = -EINVAL;
835835
goto free_fences;
836836
}
@@ -847,7 +847,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data,
847847

848848
dma_resv_for_each_fence(&resv_cursor, gobj_write[i]->resv,
849849
DMA_RESV_USAGE_WRITE, fence) {
850-
if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) {
850+
if (num_fences >= wait_info->num_fences) {
851851
r = -EINVAL;
852852
goto free_fences;
853853
}
@@ -871,7 +871,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data,
871871
goto free_fences;
872872

873873
dma_fence_unwrap_for_each(f, &iter, fence) {
874-
if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) {
874+
if (num_fences >= wait_info->num_fences) {
875875
r = -EINVAL;
876876
goto free_fences;
877877
}
@@ -895,7 +895,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void *data,
895895
if (r)
896896
goto free_fences;
897897

898-
if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) {
898+
if (num_fences >= wait_info->num_fences) {
899899
r = -EINVAL;
900900
goto free_fences;
901901
}

0 commit comments

Comments
 (0)