diff options
author | Jeremy Cline <jcline@redhat.com> | 2021-01-11 16:05:28 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2021-01-14 00:23:39 -0500 |
commit | 8b335bff643f3b39935c7377dbcd361c5b605d98 (patch) | |
tree | 853743ee38ed6a5ad41dd4b9b19dc07b09828c65 /mm | |
parent | 4eec66c014e9a406d8d453de958f6791d05427e4 (diff) |
drm/amdkfd: Fix out-of-bounds read in kdf_create_vcrat_image_cpu()
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: b7b6c38529c9 ("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>
Diffstat (limited to 'mm')
0 files changed, 0 insertions, 0 deletions