From 5a43e5c8e6e6f47e96055260ae81df985a5f97ed Mon Sep 17 00:00:00 2001 From: Tim Huang Date: Thu, 19 Sep 2024 13:13:07 +0000 Subject: [PATCH] drm/amdgpu: fix ucode out-of-bounds read mainline inclusion from mainline-v6.11-rc1 commit 8944acd0f9db33e17f387fdc75d33bb473d7936f category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IARV6G CVE: CVE-2024-46723 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8944acd0f9db33e17f387fdc75d33bb473d7936f -------------------------------- Clear warning that read ucode[] may out-of-bounds. Signed-off-by: Tim Huang Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Liao Chen --- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index 78ac6dbe70d8..854b21860257 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c @@ -213,6 +213,9 @@ static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device, struct amdgpu_firmware_info *ucode; id = fw_type_convert(cgs_device, type); + if (id >= AMDGPU_UCODE_ID_MAXIMUM) + return -EINVAL; + ucode = &adev->firmware.ucode[id]; if (ucode->fw == NULL) return -EINVAL; -- Gitee