aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
diff options
context:
space:
mode:
authorCandice Li <candice.li@amd.com>2024-08-15 11:37:28 +0800
committerAlex Deucher <alexander.deucher@amd.com>2024-08-20 22:14:13 -0400
commitc0a04e3570d72aaf090962156ad085e37c62e442 (patch)
treee5e67ace6d62c43a0489a6e2be353919a56a30c5 /drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
parentdrm/amdkfd: Update BadOpcode Interrupt handling with MES (diff)
downloadwireguard-linux-c0a04e3570d72aaf090962156ad085e37c62e442.tar.xz
wireguard-linux-c0a04e3570d72aaf090962156ad085e37c62e442.zip
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>
Diffstat (limited to '')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
index 0c856005df6b..38face981c3e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c
@@ -166,6 +166,9 @@ static ssize_t ta_if_load_debugfs_write(struct file *fp, const char *buf, size_t
if (ret)
return -EFAULT;
+ if (ta_bin_len > PSP_1_MEG)
+ return -EINVAL;
+
copy_pos += sizeof(uint32_t);
ta_bin = kzalloc(ta_bin_len, GFP_KERNEL);