Skip to content

Commit c99769b

Browse files
candicelicyalexdeucher
authored andcommitted
drm/amdgpu: Validate TA binary size
Add TA binary size validation to avoid OOB write. Signed-off-by: Candice Li <[email protected]> Reviewed-by: Hawking Zhang <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit c0a04e3) Cc: [email protected]
1 parent e3e4bf5 commit c99769b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ static ssize_t ta_if_load_debugfs_write(struct file *fp, const char *buf, size_t
166166
if (ret)
167167
return -EFAULT;
168168

169+
if (ta_bin_len > PSP_1_MEG)
170+
return -EINVAL;
171+
169172
copy_pos += sizeof(uint32_t);
170173

171174
ta_bin = kzalloc(ta_bin_len, GFP_KERNEL);

0 commit comments

Comments
 (0)