drm/amdgpu: add error handle to avoid out-of-bounds
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +3 -0
@@ -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);
Signature · 1 line
2.34.1
Am 23.04.24 um 11:15 schrieb Bob Zhou:
Quoted 4 lines
if the
sdma_v4_0_irq_id_to_seqreturn-EINVAL, the process should be stop to avoid out-of-bounds read, so directly return-EINVAL.Signed-off-by Bob Zhou <[email protected]>
Quoted 18 lines
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +3
-0@@ -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);
[AMD Official Use Only - General]
Thanks for catching. Please populate the fix to sdma_v4_4_2 as well if necessary.
Quoted 34 lines
-----Original Message-----
From: Bob Zhou <[email protected]>
Sent: Tuesday, April 23, 2024 5:15 PM
To: [email protected]; Ma, Le <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Zhou, Bob <[email protected]>
Subject: [PATCH] drm/amdgpu: add error handle to avoid out-of-boundsif the
sdma_v4_0_irq_id_to_seqreturn-EINVAL, the process should be stop to avoid out-of-bounds read, so directly return-EINVAL.Signed-off-by Bob Zhou <[email protected]>--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +3
-0@@ -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);--
2.34.1