drm/amd/amdgpu: ring debugfs is read in increments of 4 bytes
authorTom St Denis <tom.stdenis@amd.com>
Mon, 2 May 2016 12:35:35 +0000 (08:35 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 18:51:11 +0000 (14:51 -0400)
If a user tries to read a non-multiple of 4 bytes it would have
read until the end of the ring potentially crashing the user
task.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c

index 5491696ac8270c98d552129d0d670baa6f57d58d..942111517e409d29916841a651c704c3bfcf63e2 100644 (file)
@@ -383,7 +383,7 @@ static ssize_t amdgpu_debugfs_ring_read(struct file *f, char __user *buf,
        int r, i;
        uint32_t value, result, early[3];
 
-       if (*pos & 3)
+       if (*pos & 3 || size & 3)
                return -EINVAL;
 
        result = 0;