summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorBob Zhou <bob.zhou@amd.com>2024-04-23 16:58:11 +0800
committerAlex Deucher <alexander.deucher@amd.com>2024-04-26 17:22:43 -0400
commit8b2faf1a4f3b6c748c0da36cda865a226534d520 (patch)
treeb2bcc9d9b61b3caa695e91a9e651ce087b39c8ef /drivers/gpu/drm/amd
parent2e55bcf3d742a4946d862b86e39e75a95cc6f1c0 (diff)
downloadlinux-stable-8b2faf1a4f3b6c748c0da36cda865a226534d520.tar.gz
linux-stable-8b2faf1a4f3b6c748c0da36cda865a226534d520.tar.bz2
linux-stable-8b2faf1a4f3b6c748c0da36cda865a226534d520.zip
drm/amdgpu: add error handle to avoid out-of-bounds
if the sdma_v4_0_irq_id_to_seq return -EINVAL, the process should be stop to avoid out-of-bounds read, so directly return -EINVAL. Signed-off-by: Bob Zhou <bob.zhou@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Reviewed-by: Le Ma <le.ma@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index e2e3856938ed..101038395c3b 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -2021,6 +2021,9 @@ static int sdma_v4_0_process_trap_irq(struct amdgpu_device *adev,
DRM_DEBUG("IH: SDMA trap\n");
instance = sdma_v4_0_irq_id_to_seq(entry->client_id);
+ if (instance < 0)
+ return instance;
+
switch (entry->ring_id) {
case 0:
amdgpu_fence_process(&adev->sdma.instance[instance].ring);