DragonFlyBSD Kernel Audit
DF-0237 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/kern/kern_wdog.c b/sys/kern/kern_wdog.c
--- a/sys/kern/kern_wdog.c
+++ b/sys/kern/kern_wdog.c
@@ -188,7 +188,12 @@
 static int
 wdog_ioctl(struct dev_ioctl_args *ap)
 {
-	if (wdog_auto_enable)
+	int _autoen;
+
+	spin_lock(&wdogmtx);
+	_autoen = wdog_auto_enable;
+	spin_unlock(&wdogmtx);
+	if (_autoen)
 		return EINVAL;
 
 	if (ap->a_cmd == WDIOCRESET) {