Use netmsg_service_sync() to protect vlan_input_p
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 23 Sep 2008 11:50:11 +0000 (11:50 +0000)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 23 Sep 2008 11:50:11 +0000 (11:50 +0000)
sys/net/if_ethersubr.c
sys/net/vlan/if_vlan.c

index 3e97f89..f82ed03 100644 (file)
@@ -32,7 +32,7 @@
  *
  *     @(#)if_ethersubr.c      8.1 (Berkeley) 6/10/93
  * $FreeBSD: src/sys/net/if_ethersubr.c,v 1.70.2.33 2003/04/28 15:45:53 archie Exp $
- * $DragonFly: src/sys/net/if_ethersubr.c,v 1.90 2008/09/20 10:53:16 sephe Exp $
+ * $DragonFly: src/sys/net/if_ethersubr.c,v 1.91 2008/09/23 11:50:11 sephe Exp $
  */
 
 #include "opt_atalk.h"
@@ -1108,8 +1108,11 @@ post_stats:
        KKASSERT(ether_type != ETHERTYPE_VLAN);
 
        if (m->m_flags & M_VLANTAG) {
-               if (vlan_input_p != NULL) {
-                       vlan_input_p(m);
+               void (*vlan_input_func)(struct mbuf *);
+
+               vlan_input_func = vlan_input_p;
+               if (vlan_input_func != NULL) {
+                       vlan_input_func(m);
                } else {
                        m->m_pkthdr.rcvif->if_noproto++;
                        m_freem(m);
index 33d2ea6..a73d487 100644 (file)
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/net/if_vlan.c,v 1.15.2.13 2003/02/14 22:25:58 fenner Exp $
- * $DragonFly: src/sys/net/vlan/if_vlan.c,v 1.40 2008/09/17 08:51:30 sephe Exp $
+ * $DragonFly: src/sys/net/vlan/if_vlan.c,v 1.41 2008/09/23 11:50:11 sephe Exp $
  */
 
 /*
@@ -250,7 +250,13 @@ vlan_modevent(module_t mod, int type, void *data)
 
        case MOD_UNLOAD:
                if_clone_detach(&vlan_cloner);
+
                vlan_input_p = NULL;
+               /*
+                * Make that all protocol threads see vlan_input_p change.
+                */
+               netmsg_service_sync();
+
                EVENTHANDLER_DEREGISTER(ifnet_detach_event,
                                        vlan_ifdetach_cookie);
                while (!LIST_EMPTY(&ifv_list))