Skip to content

Commit ad2efae

Browse files
Tom St Denisgregkh
authored andcommitted
drm/amd/amdgpu: Return error if initiating read out of range on vram
commit 9156e72 upstream. If you initiate a read that is out of the VRAM address space return ENXIO instead of 0. Reads that begin below that point will read upto the VRAM limit as before. Signed-off-by: Tom St Denis <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a89b6e3 commit ad2efae

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,9 @@ static ssize_t amdgpu_ttm_vram_read(struct file *f, char __user *buf,
11261126
if (size & 0x3 || *pos & 0x3)
11271127
return -EINVAL;
11281128

1129+
if (*pos >= adev->mc.mc_vram_size)
1130+
return -ENXIO;
1131+
11291132
while (size) {
11301133
unsigned long flags;
11311134
uint32_t value;

0 commit comments

Comments
 (0)