From antoine@peanut.dreadbsd.org  Tue Feb 28 18:59:18 2006
Return-Path: <antoine@peanut.dreadbsd.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4B85816A422
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 28 Feb 2006 18:59:18 +0000 (GMT)
	(envelope-from antoine@peanut.dreadbsd.org)
Received: from barton.dreadbsd.org (peanut.dreadbsd.org [82.67.196.50])
	by mx1.FreeBSD.org (Postfix) with ESMTP id A1B9C43D46
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 28 Feb 2006 18:59:17 +0000 (GMT)
	(envelope-from antoine@peanut.dreadbsd.org)
Received: from barton.dreadbsd.org (localhost [127.0.0.1])
	by barton.dreadbsd.org (8.13.4/8.13.4) with ESMTP id k1SIxEKX005053
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 28 Feb 2006 19:59:14 +0100 (CET)
	(envelope-from antoine@peanut.dreadbsd.org)
Received: (from antoine@localhost)
	by barton.dreadbsd.org (8.13.4/8.13.1/Submit) id k1SIxDep005052;
	Tue, 28 Feb 2006 19:59:13 +0100 (CET)
	(envelope-from antoine)
Message-Id: <200602281859.k1SIxDep005052@barton.dreadbsd.org>
Date: Tue, 28 Feb 2006 19:59:13 +0100 (CET)
From: Antoine Brodin <antoine.brodin@laposte.net>
Reply-To: Antoine Brodin <antoine.brodin@laposte.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [netgraph][patch] memory leak in ng_tcpmss.c
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         93952
>Category:       kern
>Synopsis:       [netgraph][patch] memory leak in ng_tcpmss.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 Feb 28 19:00:18 GMT 2006
>Closed-Date:    Sat Mar 18 22:01:03 GMT 2006
>Last-Modified:  Sat Mar 18 22:01:03 GMT 2006
>Originator:     Antoine Brodin
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
none
>Environment:
System: FreeBSD barton.dreadbsd.org 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Wed Feb 22 20:15:40 CET 2006 antoine@barton.dreadbsd.org:/usr/obj/usr/src/sys/BARTON i386
>Description:
This problem concerns ng_tcpmss(4).
On hook disconnection, the per hook info which contains
the output hook and the hook stats is not freed.
>How-To-Repeat:
Use the example in ng_tcpmss man page, shutdown and unload
everything, then vmstat -m | grep netgraph
>Fix:


--- ng_tcpmss.c.diff begins here ---
Index: sys/netgraph/ng_tcpmss.c
===================================================================
RCS file: /home/ncvs/src/sys/netgraph/ng_tcpmss.c,v
retrieving revision 1.2
diff -u -p -r1.2 ng_tcpmss.c
--- sys/netgraph/ng_tcpmss.c	10 Jun 2005 12:44:21 -0000	1.2
+++ sys/netgraph/ng_tcpmss.c	28 Feb 2006 18:02:03 -0000
@@ -368,6 +368,8 @@ ng_tcpmss_disconnect(hook_p hook)
 			priv->outHook = NULL;
 	}
 
+	FREE(NG_HOOK_PRIVATE(hook), M_NETGRAPH);
+	NG_HOOK_SET_PRIVATE(hook, NULL);
 	if (NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0)
 		ng_rmnode_self(NG_HOOK_NODE(hook));
 
--- ng_tcpmss.c.diff ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: glebius 
State-Changed-When: Wed Mar 15 15:41:55 UTC 2006 
State-Changed-Why:  
Committed, thanks! 


Responsible-Changed-From-To: freebsd-bugs->glebius 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Wed Mar 15 15:41:55 UTC 2006 
Responsible-Changed-Why:  
My. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93952 
State-Changed-From-To: patched->closed 
State-Changed-By: glebius 
State-Changed-When: Sat Mar 18 22:00:51 UTC 2006 
State-Changed-Why:  
Merged to RELENG_6. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93952 
>Unformatted:
