Move nd6_ifdetach() out of netlock. In this point, the interface is
authormvs <mvs@openbsd.org>
Mon, 12 Jun 2023 21:19:54 +0000 (21:19 +0000)
committermvs <mvs@openbsd.org>
Mon, 12 Jun 2023 21:19:54 +0000 (21:19 +0000)
disconnected from everywhere. No need to hold netlock for dummy
'nd_ifinfo' release. Netlock is also not needed for
TAILQ_EMPTY(&ifp->if_*hooks) assertions.

ok kn bluhm

sys/net/if.c

index 208dd44..a4755f6 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if.c,v 1.699 2023/06/05 11:35:46 bluhm Exp $  */
+/*     $OpenBSD: if.c,v 1.700 2023/06/12 21:19:54 mvs Exp $    */
 /*     $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $  */
 
 /*
@@ -1170,6 +1170,8 @@ if_detach(struct ifnet *ifp)
                        ifafree(ifa);
                }
        }
+       splx(s);
+       NET_UNLOCK();
 
        KASSERT(TAILQ_EMPTY(&ifp->if_addrhooks));
        KASSERT(TAILQ_EMPTY(&ifp->if_linkstatehooks));
@@ -1178,8 +1180,6 @@ if_detach(struct ifnet *ifp)
 #ifdef INET6
        nd6_ifdetach(ifp);
 #endif
-       splx(s);
-       NET_UNLOCK();
 
        /* Announce that the interface is gone. */
        rtm_ifannounce(ifp, IFAN_DEPARTURE);