Commit 4d75b946 authored by Alex Deucher's avatar Alex Deucher
Browse files

drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read()



Avoid a possible buffer overflow if size is larger than 4K.

Reviewed-by: default avatarYang Wang <kevinyang.wang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
(cherry picked from commit f5d873f5)
Cc: stable@vger.kernel.org
parent f790a2c4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);