Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jun 1998 17:37:56 -0700 (PDT)
From:      castor@geocast.com
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   kern/7122: m_copypacket will fail with external mbuf clusters
Message-ID:  <199806300037.RAA14233@hub.freebsd.org>

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

>Number:         7122
>Category:       kern
>Synopsis:       m_copypacket will fail with external mbuf clusters
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 29 17:40:02 PDT 1998
>Last-Modified:
>Originator:     Castor Fu
>Organization:
Geocast Network Systems
>Release:        2.2.6-STABLE
>Environment:
FreeBSD host1.geocast.net 2.2.6-STABLE FreeBSD 2.2.6-S i386 i386
>Description:
sys/mbuf.h provides a mechanism which is seldom (if ever) used
for freeing externally managed mbuf clusters.  The 4.4 BSD book mentions that
there were problems with the original implementation because there
was no mechanism for keeping track of external references generated
for the mbuf cluster.

FreeBSD attempts to fix this by providing an ext_ref() mechanism,
and the code in m_copym() looks reasonable, though there are no
routines in the FreeBSD source tree which use this facility.  

However, these changes where not propagated through to m_copypacket().  

m_copypacket() also appears to be unused.
>How-To-Repeat:
Write something which uses an externally managed memory pool.
Wriet something which uses m_copypacket().
Spend time looking for memory leaks.

>Fix:
(clf1025) diff  /usr/src/sys/kern/uipc_mbuf.c /tmp/uipc_mbuf.c  
426,430c426
<               if(!m->m_ext.ext_ref)
<                       mclrefcnt[mtocl(m->m_ext.ext_buf)]++;
<               else
<                       (*(m->m_ext.ext_ref))(m->m_ext.ext_buf,
<                                               m->m_ext.ext_size);
---
>               mclrefcnt[mtocl(m->m_ext.ext_buf)]++;
449,453c445
<                       if(!m->m_ext.ext_ref)
<                               mclrefcnt[mtocl(m->m_ext.ext_buf)]++;
<                       else
<                               (*(m->m_ext.ext_ref))(m->m_ext.ext_buf,
<                                                       m->m_ext.ext_size);
---
>                       mclrefcnt[mtocl(m->m_ext.ext_buf)]++;

>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?199806300037.RAA14233>