diff options
| author | Gleb Smirnoff <glebius@FreeBSD.org> | 2012-12-06 08:32:28 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2012-12-06 08:32:28 +0000 |
| commit | 38cc0bfa261be414833920add3f47e8390c45e1f (patch) | |
| tree | 62719294d4a39e6f96bc33b6bd89396de3c2dffa | |
| parent | 8db7e13f1dc2bb78437832c0709ea5eeb78b5503 (diff) | |
Close possible races between state deletion and sent being sent out
from pfsync:
- Call into pfsync_delete_state() holding the state lock.
- Set the state timeout to PFTM_UNLINKED after state has been moved
to the PFSYNC_S_DEL queue in pfsync.
Reported by: Ian FREISLICH <ianf cloudseed.co.za>
Notes
svn path=/head/; revision=243941
| -rw-r--r-- | sys/netpfil/pf/pf.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 082536776532..a86e550d3521 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1487,8 +1487,6 @@ pf_unlink_state(struct pf_state *s, u_int flags) return (0); /* XXXGL: undefined actually */ } - s->timeout = PFTM_UNLINKED; - if (s->src.state == PF_TCPS_PROXY_DST) { /* XXX wire key the right one? */ pf_send_tcp(NULL, s->rule.ptr, s->key[PF_SK_WIRE]->af, @@ -1502,11 +1500,14 @@ pf_unlink_state(struct pf_state *s, u_int flags) LIST_REMOVE(s, entry); pf_src_tree_remove_state(s); - PF_HASHROW_UNLOCK(ih); if (pfsync_delete_state_ptr != NULL) pfsync_delete_state_ptr(s); + s->timeout = PFTM_UNLINKED; + + PF_HASHROW_UNLOCK(ih); + pf_detach_state(s); refcount_release(&s->refs); |
