diff options
author | kp <kp@FreeBSD.org> | 2015-07-29 06:35:36 +0000 |
---|---|---|
committer | kp <kp@FreeBSD.org> | 2015-07-29 06:35:36 +0000 |
commit | bfd9b9631461bd4158af42c519c70ab0fb9c442e (patch) | |
tree | a807aaf2516e31a20415dd96f1e588387b072b6b /sys | |
parent | 6b0f23aa74024f30bd5dcb208dd6b97b348d491d (diff) | |
download | FreeBSD-src-bfd9b9631461bd4158af42c519c70ab0fb9c442e.zip FreeBSD-src-bfd9b9631461bd4158af42c519c70ab0fb9c442e.tar.gz |
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.
PR: 201879, 201932
MFC after: 5 days
Diffstat (limited to 'sys')
-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 384f565..497f0ed 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -431,6 +431,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); @@ -1284,9 +1285,6 @@ pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short *reason, if (m == NULL) return (PF_DROP); - if (frag != NULL && (frag->fr_flags & PFFRAG_DROP)) - goto drop; - h = mtod(m, struct ip *); } else { /* non-buffering fragment cache (drops or masks overlaps) */ |