[PATCH] drm/amdgpu: add error handle to avoid out-of-bounds

Ma, Le Le.Ma at amd.com
Wed Apr 24 07:58:25 UTC 2024


[AMD Official Use Only - General]

Reviewed-by: Le Ma <le.ma at amd.com>

Thanks for catching. Please populate the fix to sdma_v4_4_2 as well if necessary.

> -----Original Message-----
> From: Bob Zhou <bob.zhou at amd.com>
> Sent: Tuesday, April 23, 2024 5:15 PM
> To: amd-gfx at lists.freedesktop.org; Ma, Le <Le.Ma at amd.com>
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian
> <Christian.Koenig at amd.com>; Zhou, Bob <Bob.Zhou at amd.com>
> Subject: [PATCH] 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 at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> 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);
> --
> 2.34.1



More information about the amd-gfx mailing list