From owner-svn-src-head@FreeBSD.ORG Thu Aug 19 23:16:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AC121065675; Thu, 19 Aug 2010 23:16:45 +0000 (UTC) (envelope-from anchie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F6878FC13; Thu, 19 Aug 2010 23:16:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7JNGjNX019206; Thu, 19 Aug 2010 23:16:45 GMT (envelope-from anchie@svn.freebsd.org) Received: (from anchie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7JNGjMx019204; Thu, 19 Aug 2010 23:16:45 GMT (envelope-from anchie@svn.freebsd.org) Message-Id: <201008192316.o7JNGjMx019204@svn.freebsd.org> From: Ana Kukec Date: Thu, 19 Aug 2010 23:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211520 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2010 23:16:45 -0000 Author: anchie Date: Thu Aug 19 23:16:44 2010 New Revision: 211520 URL: http://svn.freebsd.org/changeset/base/211520 Log: Fix mbuf leakages and remove unneccessary duplicate mbuf frees. Use the right copy of an mbuf for the IP6_EXTHDR_CHECK. Reported by: zec, hrs Approved by: bz (mentor) Modified: head/sys/netinet6/icmp6.c Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Thu Aug 19 22:55:17 2010 (r211519) +++ head/sys/netinet6/icmp6.c Thu Aug 19 23:16:44 2010 (r211520) @@ -786,14 +786,12 @@ icmp6_input(struct mbuf **mp, int *offp, goto freeit; } if (send_sendso_input_hook != NULL) { - IP6_EXTHDR_CHECK(m, off, + IP6_EXTHDR_CHECK(n, off, icmp6len, IPPROTO_DONE); error = send_sendso_input_hook(n, ifp, SND_IN, ip6len); - if (error == 0) { - m_freem(n); - return (IPPROTO_DONE); - } + if (error == 0) + goto freeit; /* -1 == no app on SEND socket */ nd6_rs_input(n, off, icmp6len); } else @@ -819,14 +817,13 @@ icmp6_input(struct mbuf **mp, int *offp, } else nd6_ra_input(m, off, icmp6len); m = NULL; - m_freem(n); goto freeit; } if (send_sendso_input_hook != NULL) { error = send_sendso_input_hook(n, ifp, SND_IN, ip6len); if (error == 0) - return (IPPROTO_DONE); + goto freeit; nd6_ra_input(n, off, icmp6len); } else nd6_ra_input(n, off, icmp6len); @@ -848,7 +845,6 @@ icmp6_input(struct mbuf **mp, int *offp, nd6_ns_input(m, off, icmp6len); } else nd6_ns_input(m, off, icmp6len); - m_freem(n); m = NULL; goto freeit; } @@ -856,7 +852,7 @@ icmp6_input(struct mbuf **mp, int *offp, error = send_sendso_input_hook(n, ifp, SND_IN, ip6len); if (error == 0) - return (IPPROTO_DONE); + goto freeit; nd6_ns_input(n, off, icmp6len); } else nd6_ns_input(n, off, icmp6len); @@ -880,7 +876,6 @@ icmp6_input(struct mbuf **mp, int *offp, nd6_na_input(m, off, icmp6len); } else nd6_na_input(m, off, icmp6len); - m_freem(n); m = NULL; goto freeit; } @@ -888,7 +883,7 @@ icmp6_input(struct mbuf **mp, int *offp, error = send_sendso_input_hook(n, ifp, SND_IN, ip6len); if (error == 0) - return (IPPROTO_DONE); + goto freeit; nd6_na_input(n, off, icmp6len); } else nd6_na_input(n, off, icmp6len); @@ -910,7 +905,6 @@ icmp6_input(struct mbuf **mp, int *offp, icmp6_redirect_input(m, off); } else icmp6_redirect_input(m, off); - m_freem(n); m = NULL; goto freeit; } @@ -918,7 +912,7 @@ icmp6_input(struct mbuf **mp, int *offp, error = send_sendso_input_hook(n, ifp, SND_IN, ip6len); if (error == 0) - return (IPPROTO_DONE); + goto freeit; icmp6_redirect_input(n, off); } else icmp6_redirect_input(n, off);