diff options
author | mvs <mvs@cvs.openbsd.org> | 2021-02-23 15:13:59 +0000 |
---|---|---|
committer | mvs <mvs@cvs.openbsd.org> | 2021-02-23 15:13:59 +0000 |
commit | 76eabb2a66448d2a52eac7e4eea69c8f9d627a79 (patch) | |
tree | 9acb08aab04d13c3942f14a7271050b33ea5889e /sys | |
parent | e5a875e5719ac3637e5000d33170a010cadf3799 (diff) |
Wrap by netlock the whole foreach loop which calls switch_port_detach() in
switch_clone_destroy(). This fixes netlock assertion within underlay
ifpromisc(). The problem was reported by hrvoje@ [1].
"why not" by deraadt@
1. https://marc.info/?l=openbsd-bugs&m=161338077403538&w=2
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_switch.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/if_switch.c b/sys/net/if_switch.c index 15c6e77065d..447e164e5b0 100644 --- a/sys/net/if_switch.c +++ b/sys/net/if_switch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_switch.c,v 1.40 2021/01/19 19:39:14 mvs Exp $ */ +/* $OpenBSD: if_switch.c,v 1.41 2021/02/23 15:13:58 mvs Exp $ */ /* * Copyright (c) 2016 Kazuya GODA <goda@openbsd.org> @@ -196,6 +196,7 @@ switch_clone_destroy(struct ifnet *ifp) struct switch_port *swpo, *tp; struct ifnet *ifs; + NET_LOCK(); TAILQ_FOREACH_SAFE(swpo, &sc->sc_swpo_list, swpo_list_next, tp) { if ((ifs = if_get(swpo->swpo_ifindex)) != NULL) { switch_port_detach(ifs); @@ -204,6 +205,7 @@ switch_clone_destroy(struct ifnet *ifp) log(LOG_ERR, "failed to cleanup on ifindex(%d)\n", swpo->swpo_ifindex); } + NET_UNLOCK(); LIST_REMOVE(sc, sc_switch_next); bstp_destroy(sc->sc_stp); swofp_destroy(sc); |