summaryrefslogtreecommitdiff
path: root/sys/net/if_aggr.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2020-04-12 06:59:55 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2020-04-12 06:59:55 +0000
commit8d88d954fd72ef57f1fc208e150f8737b253395a (patch)
tree8050b34445f438d44ab8aa6a9914eb59dc8f3a38 /sys/net/if_aggr.c
parenta432f58ec77038b60408617922f76ded78a2c4ff (diff)
take NET_LOCK in aggr_clone_destroy() before calling aggr_p_dtor()
aggr_p_dtor() calls ifpromisc(), and ifpromisc() callers need to be holding NET_LOCK to make changes to if_flags and if_pcount, and before calling the interfaces ioctl to apply the flag change. i found this while reading code with my eyes, and was able to trigger the NET_ASSERT_LOCKED in the vlan_ioctl path. ok visa@
Diffstat (limited to 'sys/net/if_aggr.c')
-rw-r--r--sys/net/if_aggr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/if_aggr.c b/sys/net/if_aggr.c
index 10cc3c66b8d..d607d5c6ff5 100644
--- a/sys/net/if_aggr.c
+++ b/sys/net/if_aggr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_aggr.c,v 1.28 2020/03/11 07:01:42 dlg Exp $ */
+/* $OpenBSD: if_aggr.c,v 1.29 2020/04/12 06:59:54 dlg Exp $ */
/*
* Copyright (c) 2019 The University of Queensland
@@ -589,8 +589,10 @@ aggr_clone_destroy(struct ifnet *ifp)
if_detach(ifp);
/* last ref, no need to lock. aggr_p_dtor locks anyway */
+ NET_LOCK();
while ((p = TAILQ_FIRST(&sc->sc_ports)) != NULL)
aggr_p_dtor(sc, p, "destroy");
+ NET_UNLOCK();
free(sc, M_DEVBUF, sizeof(*sc));