From nobody@FreeBSD.org  Tue Dec  6 03:16:25 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6B0AE1065670
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  6 Dec 2011 03:16:25 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 5AE7E8FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  6 Dec 2011 03:16:25 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id pB63GOgK045883
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 6 Dec 2011 03:16:24 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id pB63GOjd045882;
	Tue, 6 Dec 2011 03:16:24 GMT
	(envelope-from nobody)
Message-Id: <201112060316.pB63GOjd045882@red.freebsd.org>
Date: Tue, 6 Dec 2011 03:16:24 GMT
From: Herbie Robinson <Herbie.Robinson@stratus.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Duplicate free in the error return for mld_v2_encap_report in mld6.c
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         163089
>Category:       kern
>Synopsis:       Duplicate free in the error return for mld_v2_encap_report in mld6.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    glebius
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 06 03:20:09 UTC 2011
>Closed-Date:    Wed Mar 21 07:30:56 UTC 2012
>Last-Modified:  Wed Mar 21 07:40:12 UTC 2012
>Originator:     Herbie Robinson
>Release:        8
>Organization:
Stratus Technologies
>Environment:
This is a port of the IPv6 code to a non-BSD operating system.  I [think] I have checked the latest CVS and the problem is still there.
>Description:
All of this is in src/sys/netinet6/mld6.c

The call code is:

		m0 = mld_v2_encap_report(ifp, m);
		if (m0 == NULL) {
			CTR2(KTR_MLD, "%s: dropped %p", __func__, m);
			m_freem(m);

The function mld_v2_encap_report consumes the mbuf in all cases (normal and error return); so, this is duplicate.  I haven't been working with the code long enough to know whether the coding philosophy would be to delete the free from the caller or the subroutine.  I would be inclined to remove the duplicate free from the caller...

I left the priority as low because memory allocation failures are rare these days... 

>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: glebius 
State-Changed-When: Wed Dec 7 13:37:58 UTC 2011 
State-Changed-Why:  
Committed to head, thanks! 


Responsible-Changed-From-To: freebsd-bugs->glebius 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Wed Dec 7 13:37:58 UTC 2011 
Responsible-Changed-Why:  
Committed to head, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=163089 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/163089: commit references a PR
Date: Wed,  7 Dec 2011 13:37:56 +0000 (UTC)

 Author: glebius
 Date: Wed Dec  7 13:37:42 2011
 New Revision: 228321
 URL: http://svn.freebsd.org/changeset/base/228321
 
 Log:
   Fix double free.
   
   PR:		kern/163089
   Submitted by:	Herbie Robinson <Herbie.Robinson stratus.com>
 
 Modified:
   head/sys/netinet6/mld6.c
 
 Modified: head/sys/netinet6/mld6.c
 ==============================================================================
 --- head/sys/netinet6/mld6.c	Wed Dec  7 12:48:11 2011	(r228320)
 +++ head/sys/netinet6/mld6.c	Wed Dec  7 13:37:42 2011	(r228321)
 @@ -3090,7 +3090,6 @@ mld_dispatch_packet(struct mbuf *m)
  		m0 = mld_v2_encap_report(ifp, m);
  		if (m0 == NULL) {
  			CTR2(KTR_MLD, "%s: dropped %p", __func__, m);
 -			m_freem(m);
  			IP6STAT_INC(ip6s_odropped);
  			goto out;
  		}
 _______________________________________________
 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-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: glebius 
State-Changed-When: Wed Mar 21 07:29:54 UTC 2012 
State-Changed-Why:  
Merged to stable/9. 

Awfully sorry, but I was out of time and didn't merged it 
to stable/8 prior to 8.3-RELEASE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=163089 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/163089: commit references a PR
Date: Wed, 21 Mar 2012 07:30:05 +0000 (UTC)

 Author: glebius
 Date: Wed Mar 21 07:29:47 2012
 New Revision: 233266
 URL: http://svn.freebsd.org/changeset/base/233266
 
 Log:
   Merge 228321 from head:
     Fix double free.
   
     PR:           kern/163089
     Submitted by: Herbie Robinson <Herbie.Robinson stratus.com>
 
 Modified:
   stable/9/sys/netinet6/mld6.c
 Directory Properties:
   stable/9/sys/   (props changed)
   stable/9/sys/amd64/include/xen/   (props changed)
   stable/9/sys/boot/   (props changed)
   stable/9/sys/boot/i386/efi/   (props changed)
   stable/9/sys/boot/ia64/efi/   (props changed)
   stable/9/sys/boot/ia64/ski/   (props changed)
   stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
   stable/9/sys/boot/powerpc/ofw/   (props changed)
   stable/9/sys/cddl/contrib/opensolaris/   (props changed)
   stable/9/sys/conf/   (props changed)
   stable/9/sys/contrib/dev/acpica/   (props changed)
   stable/9/sys/contrib/octeon-sdk/   (props changed)
   stable/9/sys/contrib/pf/   (props changed)
   stable/9/sys/contrib/x86emu/   (props changed)
   stable/9/sys/fs/   (props changed)
   stable/9/sys/fs/ntfs/   (props changed)
   stable/9/sys/i386/conf/XENHVM   (props changed)
 
 Modified: stable/9/sys/netinet6/mld6.c
 ==============================================================================
 --- stable/9/sys/netinet6/mld6.c	Wed Mar 21 07:22:27 2012	(r233265)
 +++ stable/9/sys/netinet6/mld6.c	Wed Mar 21 07:29:47 2012	(r233266)
 @@ -3096,7 +3096,6 @@ mld_dispatch_packet(struct mbuf *m)
  		m0 = mld_v2_encap_report(ifp, m);
  		if (m0 == NULL) {
  			CTR2(KTR_MLD, "%s: dropped %p", __func__, m);
 -			m_freem(m);
  			IP6STAT_INC(ip6s_odropped);
  			goto out;
  		}
 _______________________________________________
 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-unsubscribe@freebsd.org"
 
>Unformatted:
