From 61dfecf3d1fafb5549a25f5a83a61f701863afb1 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 17 Jun 2024 07:21:57 +0000 Subject: [PATCH] drm/amdgpu: add error handle to avoid out-of-bounds From Bob Zhou 5b0a3dc3e87821acb80e841b464d335aff242691 in linux-6.6.y/6.6.34 8b2faf1a4f3b6c748c0da36cda865a226534d520 in mainline linux --- sys/dev/pci/drm/amd/amdgpu/sdma_v4_0.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/pci/drm/amd/amdgpu/sdma_v4_0.c b/sys/dev/pci/drm/amd/amdgpu/sdma_v4_0.c index 5854767cc75..b5d62cef573 100644 --- a/sys/dev/pci/drm/amd/amdgpu/sdma_v4_0.c +++ b/sys/dev/pci/drm/amd/amdgpu/sdma_v4_0.c @@ -2031,6 +2031,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); -- 2.20.1