DragonFlyBSD Kernel Audit
DF-2018 / 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
@@ -332,7 +332,11 @@
  */
 bool drm_is_current_master(struct drm_file *fpriv)
 {
-	return fpriv->is_master;
+	/* DF-2018: compare master pointers instead of returning the sticky
+	 * is_master flag, so DRM_MASTER authority is revoked once the device
+	 * master is reassigned away from this fd. */
+	return fpriv->is_master &&
+	    fpriv->master == fpriv->minor->dev->master;
 }
 EXPORT_SYMBOL(drm_is_current_master);