Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 May 2002 12:41:54 -0700 (PDT)
From:      Archie Cobbs <archie@packetdesign.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/38745: improper ordering of mbinit() wrt. device drivers
Message-ID:  <200205301941.g4UJfsP47284@bubba.packetdesign.com>

next in thread | raw e-mail | index | archive | help

>Number:         38745
>Category:       kern
>Synopsis:       improper ordering of mbinit() wrt. device drivers
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 30 12:50:01 PDT 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205301941.g4UJfsP47284>