⬢ DragonFlyBSD Kernel Audit
DF-3864 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/amd/amdgpu/amdgpu_vm.c
+++ b/sys/dev/drm/amd/amdgpu/amdgpu_vm.c
@@ -3134,11 +3134,15 @@
 	return 0;
 
 error_unreserve:
-	amdgpu_bo_unreserve(vm->root.base.bo);
+	/* DF-3864: on the amdgpu_vm_clear_bo() failure path
+	 * amdgpu_vm_bo_base_init() has not run yet, so vm->root.base.bo is
+	 * still NULL.  Always use the local root pointer here.
+	 */
+	amdgpu_bo_unreserve(root);
 
 error_free_root:
-	amdgpu_bo_unref(&vm->root.base.bo->shadow);
-	amdgpu_bo_unref(&vm->root.base.bo);
+	amdgpu_bo_unref(&root->shadow);
+	amdgpu_bo_unref(&root);
 	vm->root.base.bo = NULL;
 
 error_free_sched_entity: