Author: bz
Date: Fri Sep 30 18:20:16 2011
New Revision: 225885
URL: http://svn.freebsd.org/changeset/base/225885

Log:
  Fix an obvious bug from r186196 shadowing a variable, not correctly
  appending the new mbuf to the chain reference but possibly causing an mbuf
  nextpkt loop leading to a memory used after handoff (or having been freed)
  and leaking an mbuf here.
  
  Reviewed by:  rwatson, brooks
  MFC after:    3 days

Modified:
  head/sys/netinet6/nd6.c

Modified: head/sys/netinet6/nd6.c
==============================================================================
--- head/sys/netinet6/nd6.c     Fri Sep 30 08:05:58 2011        (r225884)
+++ head/sys/netinet6/nd6.c     Fri Sep 30 18:20:16 2011        (r225885)
@@ -2042,14 +2042,15 @@ nd6_output_lle(struct ifnet *ifp, struct
                if (*chain == NULL)
                        *chain = m;
                else {
-                       struct mbuf *m = *chain;
+                       struct mbuf *mb;
 
                        /*
                         * append mbuf to end of deferred chain
                         */
-                       while (m->m_nextpkt != NULL)
-                               m = m->m_nextpkt;
-                       m->m_nextpkt = m;
+                       mb = *chain;
+                       while (mb->m_nextpkt != NULL)
+                               mb = mb->m_nextpkt;
+                       mb->m_nextpkt = m;
                }
                return (error);
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to