summaryrefslogtreecommitdiff
path: root/sys/net/if_aggr.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2019-11-07 08:07:18 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2019-11-07 08:07:18 +0000
commitecfb8e35ce9da4380a7aef351bba3d5a577f9e15 (patch)
tree462b2bc10ff4f1a4e4cdb3b7907df7148b6ed774 /sys/net/if_aggr.c
parent21d5fb1156f1a9b50d8577aa316ed3939e987877 (diff)
move the port destructor calls in clone destroy back out of NET_LOCK.
it's no longer necessary to hold NET_LOCK to call interface hook adds or dels now, but it is necessary not to hold NET_LOCK when calling some barrier functions. found by hrvoje popovski
Diffstat (limited to 'sys/net/if_aggr.c')
-rw-r--r--sys/net/if_aggr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/net/if_aggr.c b/sys/net/if_aggr.c
index 3744abbe898..7ae5c366dbb 100644
--- a/sys/net/if_aggr.c
+++ b/sys/net/if_aggr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_aggr.c,v 1.21 2019/11/07 07:36:31 dlg Exp $ */
+/* $OpenBSD: if_aggr.c,v 1.22 2019/11/07 08:07:17 dlg Exp $ */
/*
* Copyright (c) 2019 The University of Queensland
@@ -583,14 +583,15 @@ aggr_clone_destroy(struct ifnet *ifp)
if (ISSET(ifp->if_flags, IFF_RUNNING))
aggr_down(sc);
-
- while ((p = TAILQ_FIRST(&sc->sc_ports)) != NULL)
- aggr_p_dtor(sc, p, "destroy");
NET_UNLOCK();
ether_ifdetach(ifp);
if_detach(ifp);
+ /* last ref, no need to lock. aggr_p_dtor locks anyway */
+ while ((p = TAILQ_FIRST(&sc->sc_ports)) != NULL)
+ aggr_p_dtor(sc, p, "destroy");
+
free(sc, M_DEVBUF, sizeof(*sc));
return (0);