⬢ DragonFlyBSD Kernel Audit
DF-4564 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/radeon/radeon_kms.c
+++ b/sys/dev/drm/radeon/radeon_kms.c
@@ -666,13 +666,17 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
 			/* map the ib pool buffer read only into
 			 * virtual address space */
 			vm->ib_bo_va = radeon_vm_bo_add(rdev, vm,
 							rdev->ring_tmp_bo.bo);
 			if (!vm->ib_bo_va) {
+				radeon_bo_unreserve(rdev->ring_tmp_bo.bo);
 				r = -ENOMEM;
 				goto err_vm_fini;
 			}
 
 			r = radeon_vm_bo_set_addr(rdev, vm->ib_bo_va,
 						  RADEON_VA_IB_OFFSET,
 						  RADEON_VM_PAGE_READABLE |
 						  RADEON_VM_PAGE_SNOOPED);
+			radeon_bo_unreserve(rdev->ring_tmp_bo.bo);
 			if (r)
 				goto err_vm_fini;
 		}
 
Restore the two upstream (Linux v3.18 radeon_kms.c) radeon_bo_unreserve()
calls that the DragonFly port dropped, so the IB-pool BO reservation is
released on both the success and error paths of radeon_driver_open_kms().