drm/amdgpu: fix VM leaf walking
authorChristian König <[email protected]>
Wed, 24 Oct 2018 14:25:23 +0000 (16:25 +0200)
committerAlex Deucher <[email protected]>
Fri, 26 Oct 2018 18:27:06 +0000 (13:27 -0500)
Make sure we don't try to go down further after the leave walk already
ended. This fixes a crash with a new VM test.

Signed-off-by: Christian König <[email protected]>
Reviewed-by: Felix Kuehling <[email protected]>
Acked-by: Alex Deucher <[email protected]>
Tested-by: Rex Zhu [email protected]
Signed-off-by: Alex Deucher <[email protected]>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index db0cbf8d219d75931fb7e8a1a05bee9a8e6c9ba8..352b304090602e342ef6f584acab90edf126f51a 100644 (file)
@@ -542,7 +542,8 @@ static void amdgpu_vm_pt_next_leaf(struct amdgpu_device *adev,
                                   struct amdgpu_vm_pt_cursor *cursor)
 {
        amdgpu_vm_pt_next(adev, cursor);
-       while (amdgpu_vm_pt_descendant(adev, cursor));
+       if (cursor->pfn != ~0ll)
+               while (amdgpu_vm_pt_descendant(adev, cursor));
 }
 
 /**