[PATCH] kern/95357: if_tap knlist of vmnet device is incorrectly destroyed by tapclose()

Maksim Yevmenkin maksim.yevmenkin at savvis.net
Mon May 15 14:57:17 PDT 2006


dear hackers,

are there any objections to the attached patch?

could if_tap/vmnet users please give it a try to see if this fixes the 
panic on -current?

thanks,
max
-------------- next part --------------
--- if_tap.c.orig	Thu Mar 16 13:04:23 2006
+++ if_tap.c	Mon May 15 14:44:14 2006
@@ -219,6 +219,7 @@
 			KASSERT(!(tp->tap_flags & TAP_OPEN), 
 				("%s flags is out of sync", ifp->if_xname));
 
+			knlist_destroy(&tp->tap_rsel.si_note);
 			destroy_dev(tp->tap_dev);
 			s = splimp();
 			ether_ifdetach(ifp);
@@ -354,6 +355,8 @@
 	tp->tap_flags |= TAP_INITED;
 	mtx_unlock(&tp->tap_mtx);
 
+	knlist_init(&tp->tap_rsel.si_note, NULL, NULL, NULL, NULL);
+
 	TAPDEBUG("interface %s is created. minor = %#x\n", 
 		ifp->if_xname, minor(dev));
 } /* tapcreate */
@@ -405,8 +408,6 @@
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 	splx(s);
 
-	knlist_init(&tp->tap_rsel.si_note, NULL, NULL, NULL, NULL);
-
 	TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, minor(dev));
 
 	return (0);
@@ -458,8 +459,6 @@
 	tp->tap_flags &= ~TAP_OPEN;
 	tp->tap_pid = 0;
 	mtx_unlock(&tp->tap_mtx);
-
-	knlist_destroy(&tp->tap_rsel.si_note);
 
 	TAPDEBUG("%s is closed. minor = %#x\n", 
 		ifp->if_xname, minor(dev));


More information about the freebsd-current mailing list