Author: glebius
Date: Tue Dec  8 16:46:00 2020
New Revision: 368448
URL: https://svnweb.freebsd.org/changeset/base/368448

Log:
  The list of ports in configuration path shall be protected by locks,
  epoch shall be used only for fast path.  Thus use LAGG_XLOCK() in
  lagg_[un]register_vlan.  This fixes sleeping in epoch panic.
  
  PR:           240609

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==============================================================================
--- head/sys/net/if_lagg.c      Tue Dec  8 16:43:35 2020        (r368447)
+++ head/sys/net/if_lagg.c      Tue Dec  8 16:46:00 2020        (r368448)
@@ -471,17 +471,16 @@ lagg_proto_portreq(struct lagg_softc *sc, struct lagg_
 static void
 lagg_register_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
 {
-       struct epoch_tracker et;
        struct lagg_softc *sc = ifp->if_softc;
        struct lagg_port *lp;
 
        if (ifp->if_softc !=  arg)   /* Not our event */
                return;
 
-       NET_EPOCH_ENTER(et);
+       LAGG_XLOCK(sc);
        CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
                EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
-       NET_EPOCH_EXIT(et);
+       LAGG_XUNLOCK(sc);
 }
 
 /*
@@ -491,17 +490,16 @@ lagg_register_vlan(void *arg, struct ifnet *ifp, u_int
 static void
 lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
 {
-       struct epoch_tracker et;
        struct lagg_softc *sc = ifp->if_softc;
        struct lagg_port *lp;
 
        if (ifp->if_softc !=  arg)   /* Not our event */
                return;
 
-       NET_EPOCH_ENTER(et);
+       LAGG_XLOCK(sc);
        CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
                EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
-       NET_EPOCH_EXIT(et);
+       LAGG_XUNLOCK(sc);
 }
 
 static int
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to