Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 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>
(cherry picked from commit 2c333ea579de6cc20ea7bc50e9595ef72863e65c)

authored by

Tvrtko Ursulin and committed by
Alex Deucher
7b7d7693 49abfa81

+4 -4
+4 -4
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
··· 833 833 834 834 dma_resv_for_each_fence(&resv_cursor, gobj_read[i]->resv, 835 835 DMA_RESV_USAGE_READ, fence) { 836 - if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) { 836 + if (num_fences >= wait_info->num_fences) { 837 837 r = -EINVAL; 838 838 goto free_fences; 839 839 } ··· 850 850 851 851 dma_resv_for_each_fence(&resv_cursor, gobj_write[i]->resv, 852 852 DMA_RESV_USAGE_WRITE, fence) { 853 - if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) { 853 + if (num_fences >= wait_info->num_fences) { 854 854 r = -EINVAL; 855 855 goto free_fences; 856 856 } ··· 874 874 goto free_fences; 875 875 876 876 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) { 878 878 r = -EINVAL; 879 879 dma_fence_put(fence); 880 880 goto free_fences; ··· 899 899 if (r) 900 900 goto free_fences; 901 901 902 - if (WARN_ON_ONCE(num_fences >= wait_info->num_fences)) { 902 + if (num_fences >= wait_info->num_fences) { 903 903 r = -EINVAL; 904 904 dma_fence_put(fence); 905 905 goto free_fences;