Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Validate TA binary size

Add TA binary size validation to avoid OOB write.

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit c0a04e3570d72aaf090962156ad085e37c62e442)
Cc: stable@vger.kernel.org

authored by

Candice Li and committed by
Alex Deucher
c99769bc e3e4bf58

+3
+3
drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
··· 166 166 if (ret) 167 167 return -EFAULT; 168 168 169 + if (ta_bin_len > PSP_1_MEG) 170 + return -EINVAL; 171 + 169 172 copy_pos += sizeof(uint32_t); 170 173 171 174 ta_bin = kzalloc(ta_bin_len, GFP_KERNEL);