Author: adrian
Date: Sat Oct 11 22:08:53 2014
New Revision: 272965
URL: https://svnweb.freebsd.org/changeset/base/272965

Log:
  Merge r271647 - Fix a double-free of mbufs in rx_ixgbe_discard().
  
    fmp->buf at the free point is already part of the chain being freed,
    so double-freeing is counter-productive.
  
  Submitted by: Marc De La Gueronniere <mdelagueronni...@verisign.com>
  Sponsored by: Verisign, Inc.

Modified:
  stable/10/sys/dev/ixgbe/ixgbe.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/ixgbe/ixgbe.c
==============================================================================
--- stable/10/sys/dev/ixgbe/ixgbe.c     Sat Oct 11 21:54:23 2014        
(r272964)
+++ stable/10/sys/dev/ixgbe/ixgbe.c     Sat Oct 11 22:08:53 2014        
(r272965)
@@ -4368,11 +4368,6 @@ ixgbe_rx_discard(struct rx_ring *rxr, in
 
        rbuf = &rxr->rx_buffers[i];
 
-        if (rbuf->fmp != NULL) {/* Partial chain ? */
-               rbuf->fmp->m_flags |= M_PKTHDR;
-                m_freem(rbuf->fmp);
-                rbuf->fmp = NULL;
-       }
 
        /*
        ** With advanced descriptors the writeback
@@ -4381,7 +4376,13 @@ ixgbe_rx_discard(struct rx_ring *rxr, in
        ** the normal refresh path to get new buffers
        ** and mapping.
        */
-       if (rbuf->buf) {
+
+       if (rbuf->fmp != NULL) {/* Partial chain ? */
+               rbuf->fmp->m_flags |= M_PKTHDR;
+               m_freem(rbuf->fmp);
+               rbuf->fmp = NULL;
+               rbuf->buf = NULL; /* rbuf->buf is part of fmp's chain */
+       } else if (rbuf->buf) {
                m_free(rbuf->buf);
                rbuf->buf = NULL;
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to