[PATCH] drm/amdgpu: Fix out-of-bounds read of df_v1_7_channel_number
Huang, Tim
Tim.Huang at amd.com
Tue May 7 03:37:54 UTC 2024
[Public]
Reviewed-by: Tim Huang <Tim.Huang at amd.com>
Best Regards,
Tim Huang
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Ma Jun
> Sent: Tuesday, May 7, 2024 11:19 AM
> To: amd-gfx at lists.freedesktop.org; Koenig, Christian
> <Christian.Koenig at amd.com>; Deucher, Alexander
> <Alexander.Deucher at amd.com>
> Cc: Ma, Jun <Jun.Ma2 at amd.com>
> Subject: [PATCH] drm/amdgpu: Fix out-of-bounds read of
> df_v1_7_channel_number
>
> Check the fb_channel_number range to avoid the array out-of-bounds read error
>
> Signed-off-by: Ma Jun <Jun.Ma2 at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/df_v1_7.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/df_v1_7.c
> b/drivers/gpu/drm/amd/amdgpu/df_v1_7.c
> index 5dfab80ffff2..cd298556f7a6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/df_v1_7.c
> +++ b/drivers/gpu/drm/amd/amdgpu/df_v1_7.c
> @@ -70,6 +70,8 @@ static u32 df_v1_7_get_hbm_channel_number(struct
> amdgpu_device *adev)
> int fb_channel_number;
>
> fb_channel_number = adev->df.funcs->get_fb_channel_number(adev);
> + if (fb_channel_number >= ARRAY_SIZE(df_v1_7_channel_number))
> + fb_channel_number = 0;
>
> return df_v1_7_channel_number[fb_channel_number];
> }
> --
> 2.34.1
More information about the amd-gfx
mailing list