DragonFlyBSD Kernel Audit
DF-0125 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c
--- a/sys/kern/tty_cons.c
+++ b/sys/kern/tty_cons.c
@@ -254,6 +254,8 @@
  * User has changed the state of the console muting.
  * This may require us to open or close the device in question.
  */
+static struct lwkt_token cn_conslock = LWKT_TOKEN_INITIALIZER(cn_conslock);
+
 static int
 sysctl_kern_consmute(SYSCTL_HANDLER_ARGS)
 {
@@ -263,6 +265,7 @@
 	ocn_mute = cn_mute;
 	error = sysctl_handle_int(oidp, &cn_mute, 0, req);
 	if((error == 0) && (cn_tab != NULL) && (req->newptr != NULL)) {
+		lwkt_gettoken(&cn_conslock);
 		if(ocn_mute && !cn_mute) {
 			/*
 			 * going from muted to unmuted.. open the physical dev
@@ -294,6 +297,7 @@
 			 */
 			cn_mute = ocn_mute;
 		}
+		lwkt_reltoken(&cn_conslock);
 	}
 	return (error);
 }