⬢ DragonFlyBSD Kernel Audit
DF-4342 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/netif/mn/if_mn.c
+++ b/sys/dev/netif/mn/if_mn.c
@@ -469,8 +469,8 @@
 		chan = 1;
 	if (!sc->ch[chan])
 		mn_create_channel(sc, chan);
-	else if (sc->ch[chan]->state == UP)
-		return (EBUSY);
+	else if (sc->ch[chan]->hook != NULL)
+		return (EBUSY);		/* a hook already owns this channel */
 	sc->ch[chan]->ts = ts;
 	sc->ch[chan]->hook = hook;
 	sc->ch[chan]->tx_limit = nbit * 8;
@@ -756,6 +756,7 @@
 	if (sch->state == DOWN)
 		return (0);
 	sch->state = DOWN;
+	sch->hook = NULL;	/* one owner at a time; closes DF-1540 */
 
 	/* Set receiver & transmitter off */
 	sc->m32_mem.cs[chan].flags = 0x80920006;