drm/amdgpu: Validate TA binary size
authorjsg <jsg@openbsd.org>
Fri, 30 Aug 2024 04:20:12 +0000 (04:20 +0000)
committerjsg <jsg@openbsd.org>
Fri, 30 Aug 2024 04:20:12 +0000 (04:20 +0000)
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

index 8e8afbd..9aff579 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);