]> Git Repo - J-linux.git/commitdiff
drm/amdgpu: Validate TA binary size
authorCandice Li <[email protected]>
Thu, 15 Aug 2024 03:37:28 +0000 (11:37 +0800)
committerAlex Deucher <[email protected]>
Wed, 21 Aug 2024 03:04:17 +0000 (23:04 -0400)
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 c0a04e3570d72aaf090962156ad085e37c62e442)
Cc: [email protected]
drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c

index 0c856005df6b95642af7b7ae4bdbf6a33a86f7ee..38face981c3e38779f4f93db6a0cdf739e6d60a8 100644 (file)
@@ -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);
This page took 0.068485 seconds and 4 git commands to generate.