DragonFlyBSD Kernel Audit
DF-0189 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c
--- a/sys/kern/subr_log.c
+++ b/sys/kern/subr_log.c
@@ -95,9 +95,8 @@
 	struct proc *p = curproc;
 
 	KKASSERT(p != NULL);
-	if (log_open)
+	if (atomic_cmpset_int(&log_open, 0, 1) == 0)
 		return (EBUSY);
-	log_open = 1;
 	callout_init_mp(&logsoftc.sc_callout);
 	fsetown(p->p_pid, &logsoftc.sc_sigio);	/* signal process only */
 	callout_reset(&logsoftc.sc_callout, hz / log_wakeups_per_second,