summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrzalamena <rzalamena@openbsd.org>2016-11-22 23:23:12 +0000
committerrzalamena <rzalamena@openbsd.org>2016-11-22 23:23:12 +0000
commita82aca11faa988c1a80e0eb8b408093f4a49c5b9 (patch)
tree729b09787c2dff438d9e027c5afe62216969c12b
parentDon't attempt to call vm_remove() with a NULL vm: some functions like (diff)
downloadwireguard-openbsd-a82aca11faa988c1a80e0eb8b408093f4a49c5b9.tar.xz
wireguard-openbsd-a82aca11faa988c1a80e0eb8b408093f4a49c5b9.zip
Fix panic on detach hook when interfaces get destroyed.
ok reyk@
-rw-r--r--sys/net/if_switch.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/if_switch.c b/sys/net/if_switch.c
index c27edd1601c..e717b7885de 100644
--- a/sys/net/if_switch.c
+++ b/sys/net/if_switch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_switch.c,v 1.14 2016/11/20 12:45:26 reyk Exp $ */
+/* $OpenBSD: if_switch.c,v 1.15 2016/11/22 23:23:12 rzalamena Exp $ */
/*
* Copyright (c) 2016 Kazuya GODA <goda@openbsd.org>
@@ -625,10 +625,11 @@ void
switch_port_detach(void *arg)
{
struct ifnet *ifp = (struct ifnet *)arg;
- struct switch_softc *sc = ifp->if_softc;
+ struct switch_softc *sc;
struct switch_port *swpo;
swpo = (struct switch_port *)ifp->if_switchport;
+ sc = swpo->swpo_switch;
if (swpo->swpo_flags & IFBIF_LOCAL)
switch_port_unset_local(sc, swpo);