DragonFlyBSD Kernel Audit
DF-2017 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/drm_auth.c b/sys/dev/drm/drm_auth.c
--- a/sys/dev/drm/drm_auth.c
+++ b/sys/dev/drm/drm_auth.c
@@ -195,9 +195,12 @@
 	 * XXX fixme
 	 */
 	if (dev->master) {
-		kprintf("drm_setmaster_ioctl: already has one XXX ignored\n");
-		//ret = -EINVAL;
-		//goto out_unlock;
+		/* DF-2017: enforce master exclusivity (matches upstream
+		 * Linux). Refuse SET_MASTER when another master already holds
+		 * the device, instead of overwriting dev->master and leaking
+		 * the prior master refcount. */
+		ret = -EINVAL;
+		goto out_unlock;
 	}
 
 	if (!file_priv->master) {