The global list of softc is *not* accessed in the input path, so it
doesn't need splnet().

ioctl(2) handlers are already executed with the NET_LOCK() held, so
splnet() is superfluous.

ok?

Index: net/if_trunk.c
===================================================================
RCS file: /cvs/src/sys/net/if_trunk.c,v
retrieving revision 1.129
diff -u -p -r1.129 if_trunk.c
--- net/if_trunk.c      22 Jan 2017 10:17:39 -0000      1.129
+++ net/if_trunk.c      26 May 2017 14:51:08 -0000
@@ -210,19 +210,15 @@ trunk_clone_destroy(struct ifnet *ifp)
 {
        struct trunk_softc *tr = (struct trunk_softc *)ifp->if_softc;
        struct trunk_port *tp;
-       int error, s;
+       int error;
 
        /* Remove any multicast groups that we may have joined. */
        trunk_ether_purgemulti(tr);
 
-       s = splnet();
-
        /* Shutdown and remove trunk ports, return on error */
        while ((tp = SLIST_FIRST(&tr->tr_ports)) != NULL) {
-               if ((error = trunk_port_destroy(tp)) != 0) {
-                       splx(s);
+               if ((error = trunk_port_destroy(tp)) != 0)
                        return (error);
-               }
        }
 
        ifmedia_delete_instance(&tr->tr_media, IFM_INST_ANY);
@@ -232,8 +228,6 @@ trunk_clone_destroy(struct ifnet *ifp)
        SLIST_REMOVE(&trunk_list, tr, trunk_softc, tr_entries);
        free(tr, M_DEVBUF, sizeof *tr);
 
-       splx(s);
-
        return (0);
 }
 
@@ -474,9 +468,7 @@ trunk_port_ioctl(struct ifnet *ifp, u_lo
        struct trunk_reqport *rp = (struct trunk_reqport *)data;
        struct trunk_softc *tr;
        struct trunk_port *tp = NULL;
-       int s, error = 0;
-
-       s = splnet();
+       int error = 0;
 
        /* Should be checked by the caller */
        if (ifp->if_type != IFT_IEEE8023ADLAG ||
@@ -512,12 +504,9 @@ trunk_port_ioctl(struct ifnet *ifp, u_lo
                goto fallback;
        }
 
-       splx(s);
        return (error);
 
  fallback:
-       splx(s);
-
        if (tp != NULL)
                error = (*tp->tp_ioctl)(ifp, cmd, data);
 
@@ -616,9 +605,7 @@ trunk_ioctl(struct ifnet *ifp, u_long cm
        struct ifreq *ifr = (struct ifreq *)data;
        struct trunk_port *tp;
        struct ifnet *tpif;
-       int s, i, error = 0;
-
-       s = splnet();
+       int i, error = 0;
 
        bzero(&rpbuf, sizeof(rpbuf));
 
@@ -768,7 +755,6 @@ trunk_ioctl(struct ifnet *ifp, u_long cm
        }
 
  out:
-       splx(s);
        return (error);
 }
 

Reply via email to