Skip to content

Commit

Permalink
drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read()
Browse files Browse the repository at this point in the history
Avoid a possible buffer overflow if size is larger than 4K.

Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Alex Deucher committed Nov 5, 2024
1 parent 7ba9395 commit f5d873f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ static ssize_t amdgpu_debugfs_gprwave_read(struct file *f, char __user *buf, siz
int r;
uint32_t *data, x;

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

r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
Expand Down

0 comments on commit f5d873f

Please sign in to comment.