[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zs3E7w1dSdxC7XoT@duo.ucw.cz>
Date: Tue, 27 Aug 2024 14:22:07 +0200
From: Pavel Machek <pavel@...x.de>
To: Sasha Levin <sashal@...nel.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Ma Jun <Jun.Ma2@....com>, Tim Huang <Tim.Huang@....com>,
Alex Deucher <alexander.deucher@....com>, christian.koenig@....com,
Xinhui.Pan@....com, airlied@...il.com, daniel@...ll.ch,
amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH AUTOSEL 6.10 034/121] drm/amdgpu: Fix out-of-bounds read
of df_v1_7_channel_number
Hi!
> [ Upstream commit d768394fa99467bcf2703bde74ddc96eeb0b71fa ]
>
> Check the fb_channel_number range to avoid the array out-of-bounds
> read error
We can still have array out-of-bounds, right? As soon as that function
returns 0x8000 0000.
drivers/gpu/drm/amd/amdgpu/amdgpu_df.h: u32 (*get_fb_channel_number)(struct amdgpu_device *adev);
int fb_channel_number should really be u32.
Best regards,
Pavel
> +++ 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];
> }
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists