]> Git Repo - J-linux.git/commitdiff
drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read()
authorAlex Deucher <[email protected]>
Wed, 23 Oct 2024 20:52:08 +0000 (16:52 -0400)
committerAlex Deucher <[email protected]>
Tue, 5 Nov 2024 15:35:59 +0000 (10:35 -0500)
Avoid a possible buffer overflow if size is larger than 4K.

Reviewed-by: Yang Wang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

index 0cb3ba448c6cf11caca47fcea85cec6cde1b9e16..a68338cb7b4afb423cb0b2cac624c401a88da8de 100644 (file)
@@ -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);
This page took 0.053257 seconds and 4 git commands to generate.