summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2023-08-08 10:19:16 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2023-08-08 10:19:16 +0000
commit3ab3a0a49b95eea032908555af765caaa89d1ffb (patch)
treed34f9cc4b7d9554eb0c25207277410ff52c0c39c /sys/net
parent03e6d2c350f1e0bbc4f302592a8a40578424dbc6 (diff)
if sec is being destroyed, prevent it from being brought up again.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_sec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/net/if_sec.c b/sys/net/if_sec.c
index f78acec715d..cf50b0e9bdf 100644
--- a/sys/net/if_sec.c
+++ b/sys/net/if_sec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sec.c,v 1.2 2023/08/08 10:14:29 dlg Exp $ */
+/* $OpenBSD: if_sec.c,v 1.3 2023/08/08 10:19:15 dlg Exp $ */
/*
* Copyright (c) 2022 The University of Queensland
@@ -83,6 +83,7 @@
struct sec_softc {
struct ifnet sc_if;
+ unsigned int sc_dead;
unsigned int sc_up;
struct task sc_send;
@@ -175,6 +176,7 @@ sec_clone_destroy(struct ifnet *ifp)
struct sec_softc *sc = ifp->if_softc;
NET_LOCK();
+ sc->sc_dead = 1;
if (ISSET(ifp->if_flags, IFF_RUNNING))
sec_down(sc);
NET_UNLOCK();
@@ -240,6 +242,9 @@ sec_up(struct sec_softc *sc)
NET_ASSERT_LOCKED();
KASSERT(!ISSET(ifp->if_flags, IFF_RUNNING));
+ if (sc->sc_dead)
+ return (ENXIO);
+
/*
* coordinate with sec_down(). if sc_up is still up and
* we're here then something else is running sec_down.