drm/amdgpu: Fix a NULL deref in amdgpu_vm_add_prt_cb()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 3 Apr 2017 18:41:39 +0000 (21:41 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 4 Apr 2017 18:42:21 +0000 (14:42 -0400)
We accidentally dereference "cb" if the kmalloc() fails.

Fixes: 451bc8eb8fe6 ("drm/amdgpu: fix PRT teardown on VM fini v3")
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index 5f3d932e77f21f93a2b33da3bdf599f5b08e0928..8c7de55f57153111c8fd70e1e94448071e4a9eae 100644 (file)
@@ -1528,7 +1528,7 @@ static void amdgpu_vm_add_prt_cb(struct amdgpu_device *adev,
                if (fence)
                        dma_fence_wait(fence, false);
 
-               amdgpu_vm_prt_put(cb->adev);
+               amdgpu_vm_prt_put(adev);
        } else {
                cb->adev = adev;
                if (!fence || dma_fence_add_callback(fence, &cb->cb,