linux-uconsole/drivers/gpu/drm/amd
Jeremy Cline eb8ca93e49 drm/amdkfd: Fix out-of-bounds read in kdf_create_vcrat_image_cpu()
[ Upstream commit 8b335bff64 ]

KASAN reported a slab-out-of-bounds read of size 1 in
kdf_create_vcrat_image_cpu().

This occurs when, for example, when on an x86_64 with a single NUMA node
because kfd_fill_iolink_info_for_cpu() is a no-op, but afterwards the
sub_type_hdr->length, which is out-of-bounds, is read and multiplied by
entries. Fortunately, entries is 0 in this case so the overall
crat_table->length is still correct.

Check if there were any entries before de-referencing sub_type_hdr which
may be pointing to out-of-bounds memory.

Fixes: b7b6c38529 ("drm/amdkfd: Calculate CPU VCRAT size dynamically (v2)")
Suggested-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Jeremy Cline <jcline@redhat.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-01-27 11:55:08 +01:00
..
acp drm: amd/acp: fix broken menu structure 2020-03-13 11:52:35 -04:00
amdgpu drm/amdgpu/psp: fix psp gfx ctrl cmds 2021-01-27 11:55:02 +01:00
amdkfd drm/amdkfd: Fix out-of-bounds read in kdf_create_vcrat_image_cpu() 2021-01-27 11:55:08 +01:00
display drm/amd/display: Fix to be able to stop crc calculation 2021-01-27 11:55:02 +01:00
include drm/amdgpu: add Green_Sardine APU flag 2020-11-04 08:30:48 -05:00
pm drm/amd/pm: fix the failure when change power profile for renoir 2021-01-19 18:27:27 +01:00