aboutsummaryrefslogtreecommitdiff
path: root/sys/net/pfvar.h
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2017-03-22 21:18:18 +0000
committerKristof Provost <kp@FreeBSD.org>2017-03-22 21:18:18 +0000
commit2f8fb3a8689169dd0b272c7718670cf58698d1a9 (patch)
tree0cdc182512664b6b92e6fee7aedd9b3e7835cb23 /sys/net/pfvar.h
parent62fd382c4360a574b8d4eabb8555afd4ebc84a45 (diff)
downloadsrc-2f8fb3a8689169dd0b272c7718670cf58698d1a9.tar.gz
src-2f8fb3a8689169dd0b272c7718670cf58698d1a9.zip
pf: Fix possible shutdown race
Prevent possible races in the pf_unload() / pf_purge_thread() shutdown code. Lock the pf_purge_thread() with the new pf_end_lock to prevent these races. Use a shared/exclusive lock, as we need to also acquire another sx lock (VNET_LIST_RLOCK). It's fine for both pf_purge_thread() and pf_unload() to sleep, Pointed out by: eri, glebius, jhb Differential Revision: https://reviews.freebsd.org/D10026
Notes
Notes: svn path=/head/; revision=315741
Diffstat (limited to 'sys/net/pfvar.h')
-rw-r--r--sys/net/pfvar.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 2b5ca39a3bf9..c5e8567f6c37 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -154,6 +154,8 @@ extern struct rwlock pf_rules_lock;
#define PF_RULES_RASSERT() rw_assert(&pf_rules_lock, RA_RLOCKED)
#define PF_RULES_WASSERT() rw_assert(&pf_rules_lock, RA_WLOCKED)
+extern struct sx pf_end_lock;
+
#define PF_MODVER 1
#define PFLOG_MODVER 1
#define PFSYNC_MODVER 1