]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdgpu: Validate TA binary size
authorCandice Li <candice.li@amd.com>
Thu, 15 Aug 2024 03:37:28 +0000 (11:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Aug 2024 15:36:06 +0000 (17:36 +0200)
commit c99769bceab4ecb6a067b9af11f9db281eea3e2a upstream.

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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c

index 8e8afbd237bcdffb74a907d30fc74e3dfd850ff4..9aff579c6abf544cef1b7d16f3609004fd0029ff 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);