From fbf36387829723819697c30d093bd0f484a9b548 Mon Sep 17 00:00:00 2001 From: jsg Date: Fri, 30 Aug 2024 04:20:12 +0000 Subject: [PATCH] drm/amdgpu: Validate TA binary size From Candice Li 50553ea7cbd3344fbf40afb065f6a2d38171c1ad in linux-6.6.y/6.6.48 c99769bceab4ecb6a067b9af11f9db281eea3e2a in mainline linux --- sys/dev/pci/drm/amd/amdgpu/amdgpu_psp_ta.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_psp_ta.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_psp_ta.c index 8e8afbd237b..9aff579c6ab 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_psp_ta.c +++ b/sys/dev/pci/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); -- 2.20.1