DragonFlyBSD Kernel Audit
DF-2075 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/drm_sysctl.c b/sys/dev/drm/drm_sysctl.c
@@ -198,9 +198,9 @@
 
 	}
 	SYSCTL_OUT(req, "", 1);
-	DRM_UNLOCK(dev);
 
 done:
+	DRM_UNLOCK(dev);
 	return 0;
 }
 
@@ -225,6 +225,10 @@
 	tempdma = *dma;
 	templists = kmalloc(sizeof(int) * dma->buf_count, M_DRM,
 			    M_WAITOK | M_NULLOK);
+	if (templists == NULL) {
+		DRM_UNLOCK(dev);
+		return ENOMEM;
+	}
 	for (i = 0; i < dma->buf_count; i++)
 		templists[i] = dma->buflist[i]->list;
 	dma = &tempdma;