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

Submitted by =?UTF-8?q?Christian=20K=C3=B6nig?= on Feb. 7, 2019, 10:43 a.m.

Details

Message ID 20190207104318.12944-1-christian.koenig@amd.com
State Accepted
Commit 7fbd31cceac0596c46394ea8745fe09b98d6ed79
Headers show
Series "drm/amdgpu: fix NULL ptr dref in the VM code" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

=?UTF-8?q?Christian=20K=C3=B6nig?= Feb. 7, 2019, 10:43 a.m.
The exclusive fence is of course perfectly optional here.

Signed-off-by: Christian K├Ânig <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

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;