drm/amdgpu: fix NULL ptr dref in the VM code

Submitted by Kuehling, Felix on Feb. 7, 2019, 2 p.m.

Details

Message ID DM5PR12MB17076F4CC70E6B2BED361EDF92680@DM5PR12MB1707.namprd12.prod.outlook.com
State New
Headers show
Series "drm/amdgpu: fix NULL ptr dref in the VM code" ( rev: 2 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Kuehling, Felix Feb. 7, 2019, 2 p.m.
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 5c935009091a..5d7c191044fc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1787,9 +1787,11 @@  static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
                        return r;

                /* Wait for any BO move to be completed */
-               r = dma_fence_wait(exclusive, true);
-               if (unlikely(r))
-                       return r;
+               if (exclusive) {
+                       r = dma_fence_wait(exclusive, true);
+                       if (unlikely(r))
+                               return r;
+               }

                params.func = amdgpu_vm_cpu_set_ptes;
                params.pages_addr = pages_addr;