summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShiwu Zhang <shiwu.zhang@amd.com>2026-05-13 13:54:58 +0800
committerAlex Deucher <alexander.deucher@amd.com>2026-06-03 13:52:30 -0400
commit6229898d46c0cbc238a6fe9f11c1ea12cf8bb9c5 (patch)
tree8556b408b88e462cc9b42bbb7ea0444fe8476cd9
parent220e2e3b9634f21633993b14b340be1c54387a4d (diff)
downloadlinux-6229898d46c0cbc238a6fe9f11c1ea12cf8bb9c5.tar.gz
linux-6229898d46c0cbc238a6fe9f11c1ea12cf8bb9c5.zip
drm/amdgpu: fix buffer overflow during vBIOS update
Clamp the buffer postion to write by setting the bin attribute to the maximum buffer size so that VFS layer will block the out-of-bounds accessing. Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 665a2632379d..e3210ce17183 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -4723,7 +4723,7 @@ rel_buf:
*/
static const struct bin_attribute psp_vbflash_bin_attr = {
.attr = {.name = "psp_vbflash", .mode = 0660},
- .size = 0,
+ .size = AMD_VBIOS_FILE_MAX_SIZE_B,
.write = amdgpu_psp_vbflash_write,
.read = amdgpu_psp_vbflash_read,
};