Skip to content

Commit 4d75b94

Browse files
committed
drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read()
Avoid a possible buffer overflow if size is larger than 4K. Reviewed-by: Yang Wang <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit f5d873f) Cc: [email protected]
1 parent f790a2c commit 4d75b94

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ static ssize_t amdgpu_debugfs_gprwave_read(struct file *f, char __user *buf, siz
402402
int r;
403403
uint32_t *data, x;
404404

405-
if (size & 0x3 || *pos & 0x3)
405+
if (size > 4096 || size & 0x3 || *pos & 0x3)
406406
return -EINVAL;
407407

408408
r = pm_runtime_get_sync(adev_to_drm(adev)->dev);

0 commit comments

Comments
 (0)