[PATCH] drm/amdgpu: fix vm_cpu_update hit NULL pointer

Monk Liu Monk.Liu at amd.com
Fri Mar 22 05:30:32 UTC 2019


should use amdgpu_bo_map, otherwise you'll hit NULL
pointer bug if with amdgpu_bo_kptr

Signed-off-by: Monk Liu <Monk.Liu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
index 9d53982..1fb6295a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
@@ -76,8 +76,10 @@ static int amdgpu_vm_cpu_update(struct amdgpu_vm_update_params *p,
 {
 	unsigned int i;
 	uint64_t value;
+	void *ptr;
 
-	pe += (unsigned long)amdgpu_bo_kptr(bo);
+	amdgpu_bo_kmap(bo, &ptr);
+	pe += (unsigned long)ptr;
 
 	trace_amdgpu_vm_set_ptes(pe, addr, count, incr, flags);
 
-- 
2.7.4



More information about the amd-gfx mailing list