浏览代码

drm/amd/amdgpu: Return error if initiating read out of range on vram

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.

Cc: stable@vger.kernel.org
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>
Tom St Denis 8 年之前
父节点
当前提交
9156e72330
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

+ 3 - 0
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

@@ -1468,6 +1468,9 @@ static ssize_t amdgpu_ttm_vram_read(struct file *f, char __user *buf,
 	if (size & 0x3 || *pos & 0x3)
 		return -EINVAL;
 
+	if (*pos >= adev->mc.mc_vram_size)
+		return -ENXIO;
+
 	while (size) {
 		unsigned long flags;
 		uint32_t value;