DragonFlyBSD Kernel Audit
DF-2054 / fix.diff
← back to finding ↓ download raw
--- /tmp/orig/dev/drm/amd/amdgpu/amdgpu_bo_list.c	2026-07-23 11:54:56.914864000 +0000
+++ dev/drm/amd/amdgpu/amdgpu_bo_list.c	2026-07-23 11:57:17.686283000 +0000
@@ -141,7 +141,10 @@
 
 error_free:
 	while (i--) {
-		struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
+		struct amdgpu_bo *bo;
+		if (array[i].tv.bo == NULL)
+			continue;
+		bo = ttm_to_amdgpu_bo(array[i].tv.bo);
 
 		amdgpu_bo_unref(&bo);
 	}
@@ -284,7 +287,7 @@
 		mutex_unlock(&fpriv->bo_list_lock);
 		if (r < 0) {
 			amdgpu_bo_list_put(list);
-			return r;
+			goto error_free;
 		}
 
 		handle = r;