summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2011-11-27 16:06:31 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2011-11-27 16:06:31 +0000
commitd589bc8371e534b4b76cb969bd6d0ef5e8b691c6 (patch)
tree1e64a3f4d65d28b8e3e382473ef811ffea5a6ce7
parent34e4688f752022636c6ddbfe9d45bf3bcf74c41c (diff)
Protect more operations in the pfsync_clone_destroy to prevent
accidental race conditions. From Erik Lax, thanks! ok dlg
-rw-r--r--sys/net/if_pfsync.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 3de25070ecc..48b8e00e8f3 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.176 2011/11/26 03:28:46 mcbride Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.177 2011/11/27 16:06:30 mikeb Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -347,6 +347,7 @@ pfsync_clone_destroy(struct ifnet *ifp)
struct pfsync_deferral *pd;
int s;
+ s = splsoftnet();
timeout_del(&sc->sc_bulkfail_tmo);
timeout_del(&sc->sc_bulk_tmo);
timeout_del(&sc->sc_tmo);
@@ -358,19 +359,18 @@ pfsync_clone_destroy(struct ifnet *ifp)
pfsync_drop(sc);
- s = splsoftnet();
while (sc->sc_deferred > 0) {
pd = TAILQ_FIRST(&sc->sc_deferrals);
timeout_del(&pd->pd_tmo);
pfsync_undefer(pd, 0);
}
- splx(s);
pool_destroy(&sc->sc_pool);
free(sc->sc_imo.imo_membership, M_IPMOPTS);
free(sc, M_DEVBUF);
pfsyncif = NULL;
+ splx(s);
return (0);
}