DragonFlyBSD Kernel Audit
DF-1010 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/bus/firewire/fwohci.c b/sys/bus/firewire/fwohci.c
--- a/sys/bus/firewire/fwohci.c
+++ b/sys/bus/firewire/fwohci.c
@@ -43,6 +43,7 @@
 #define IRX_CH 0x24
 
 #include <sys/param.h>
+#include <sys/caps.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
 #include <sys/malloc.h>
@@ -350,6 +351,10 @@
 	if (!ap->a_data)
 		return(EINVAL);
 
+	/* DF-1010: privileged OHCI register/PHY/DMA access requires root */
+	if (caps_priv_check(ap->a_cred, SYSCAP_RESTRICTEDROOT))
+		return (EPERM);
+
 	switch (ap->a_cmd) {
 	case FWOHCI_WRREG:
 #define OHCI_MAX_REG 0x800