From 31bb0ff449561529244f0d7c4eb35853b811ac8a Mon Sep 17 00:00:00 2001 From: dlg Date: Tue, 8 Aug 2023 10:19:15 +0000 Subject: [PATCH] if sec is being destroyed, prevent it from being brought up again. --- sys/net/if_sec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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. -- 2.20.1