From archie@packetdesign.com  Thu May 30 12:41:55 2002
Return-Path: <archie@packetdesign.com>
Received: from mailman.packetdesign.com (dns.packetdesign.com [65.192.41.10])
	by hub.freebsd.org (Postfix) with ESMTP id 3F59337B400
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 30 May 2002 12:41:55 -0700 (PDT)
Received: from bubba.packetdesign.com (bubba.packetdesign.com [192.168.0.223])
	by mailman.packetdesign.com (8.11.6/8.11.6) with ESMTP id g4UJftb49812
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 30 May 2002 12:41:55 -0700 (PDT)
	(envelope-from archie@packetdesign.com)
Received: (from archie@localhost)
	by bubba.packetdesign.com (8.11.6/8.11.6) id g4UJfsP47284;
	Thu, 30 May 2002 12:41:54 -0700 (PDT)
	(envelope-from archie)
Message-Id: <200205301941.g4UJfsP47284@bubba.packetdesign.com>
Date: Thu, 30 May 2002 12:41:54 -0700 (PDT)
From: Archie Cobbs <archie@packetdesign.com>
Reply-To: Archie Cobbs <archie@packetdesign.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: improper ordering of mbinit() wrt. device drivers
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         38745
>Category:       kern
>Synopsis:       improper ordering of mbinit() wrt. device drivers
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 30 12:50:01 PDT 2002
>Closed-Date:    Tue Jul 02 13:40:07 PDT 2002
>Last-Modified:  Tue Jul 02 13:40:07 PDT 2002
>Originator:     Archie Cobbs
>Release:        FreeBSD 4.5-RELEASE i386
>Organization:
Packet Design
>Environment:
System: FreeBSD bubba.packetdesign.com 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Sun Feb 3 10:00:07 PST 2002 archie@bubba.packetdesign.com:/usr/obj/usr/src/sys/BUBBA i386

>Description:

	The problem is that:

	(a) Some drivers (e.g., fxp) allocate mbuf's in their device
	    attach routine.
	(b) mbinit() is called after the device attach routines

	This means that memory is leaked at startup time because
	the first thing mbinit() does is set mmbfree and mclfree
	to NULL.

>How-To-Repeat:

	Build kernel with fxp driver.
	Boot with debugger enabled.
	Set breakpoints at mmbinit() and m_mballoc().
	Notice that the m_mballoc() breakpoint is first.

>Fix:

	Seems like SI_SUB_MBUF needs to be moved earlier, or else
	add a static flag to uipc_mbuf.c so that m_mballoc() and m_clalloc()
	can check whether mbinit() has been called yet and if not call it.

	If the latter approach is done, then we might as well get rid
	of the mbinit() SYSINIT since it becomes redundant.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: archie 
State-Changed-When: Tue Jul 2 13:39:34 PDT 2002 
State-Changed-Why:  
This was already fixed in -current. Fixed in -stable by 
revision 1.63.2.8 of src/sys/sys/kernel.h. 

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