diff options
author | gjb <gjb@FreeBSD.org> | 2015-07-30 16:06:13 +0000 |
---|---|---|
committer | gjb <gjb@FreeBSD.org> | 2015-07-30 16:06:13 +0000 |
commit | d83a2c49a324ab3f027965a6ff12e3e114983c04 (patch) | |
tree | 9d71d848c00154c3ae0acbd3f59895134a986f6f /sys/netpfil | |
parent | 519cc2faa26022a5534ebed0a9ebba8553d8ca4f (diff) | |
download | FreeBSD-src-d83a2c49a324ab3f027965a6ff12e3e114983c04.zip FreeBSD-src-d83a2c49a324ab3f027965a6ff12e3e114983c04.tar.gz |
MFC r285999 (kp):
pf: Always initialise pf_fragment.fr_flags
When we allocate the struct pf_fragment in pf_fillup_fragment() we
forgot to initialise the fr_flags field. As a result we sometimes
mistakenly thought the fragment to not be a buffered fragment.
This resulted in panics because we'd end up freeing the pf_fragment
but not removing it from V_pf_fragqueue (believing it to be part of
V_pf_cachequeue). The next time we iterated V_pf_fragqueue we'd use
a freed object and panic.
While here also fix a pf_fragment use after free in pf_normalize_ip().
pf_reassemble() frees the pf_fragment, so we can't use it any more.
X-MFS-To: releng/10.2
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/netpfil')
-rw-r--r-- | sys/netpfil/pf/pf_norm.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index 1f7d109..d56ad3c 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -433,6 +433,7 @@ pf_fillup_fragment(struct pf_fragment_cmp *key, struct pf_frent *frent, } *(struct pf_fragment_cmp *)frag = *key; + frag->fr_flags = 0; frag->fr_timeout = time_second; frag->fr_maxlen = frent->fe_len; TAILQ_INIT(&frag->fr_queue); @@ -1298,9 +1299,6 @@ pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short *reason, } } #endif - if (frag != NULL && (frag->fr_flags & PFFRAG_DROP)) - goto drop; - h = mtod(m, struct ip *); } else { /* non-buffering fragment cache (drops or masks overlaps) */ |