Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Jul 2015 17:06:28 +0000 (UTC)
From:      Glen Barber <gjb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org
Subject:   svn commit: r286083 - releng/10.2/sys/netpfil/pf
Message-ID:  <201507301706.t6UH6Sn4032544@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gjb
Date: Thu Jul 30 17:06:28 2015
New Revision: 286083
URL: https://svnweb.freebsd.org/changeset/base/286083

Log:
  MFS 286079:
  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.
  
  Approved by:	re (glebius)
  Sponsored by:	The FreeBSD Foundation

Modified:
  releng/10.2/sys/netpfil/pf/pf_norm.c
Directory Properties:
  releng/10.2/   (props changed)

Modified: releng/10.2/sys/netpfil/pf/pf_norm.c
==============================================================================
--- releng/10.2/sys/netpfil/pf/pf_norm.c	Thu Jul 30 17:04:15 2015	(r286082)
+++ releng/10.2/sys/netpfil/pf/pf_norm.c	Thu Jul 30 17:06:28 2015	(r286083)
@@ -433,6 +433,7 @@ pf_fillup_fragment(struct pf_fragment_cm
 		}
 
 		*(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 di
 			}
 		}
 #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) */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507301706.t6UH6Sn4032544>