Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 May 2002 12:42:24 -0700 (PDT)
From:      Julian Elischer <julian@elischer.org>
To:        Archie Cobbs <archie@dellroad.org>
Cc:        freebsd-net@freebsd.org
Subject:   Re: m_split() considered harmful
Message-ID:  <Pine.BSF.4.21.0205311218540.29361-100000@InterJet.elischer.org>
In-Reply-To: <200205311829.g4VITKM01684@arch20m.dellroad.org>

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


When I added these fields in freebsd1.x
(They may have gone through some metamorphesis since)
it was to support some stuff we were doing at TFS.
They were variants of similar fields in BSD4.3 RENO.
The problem that can occur is that the code that splits 
the data can end up having two references to the same external object
when the data split point lies within an external object.

In this case (if the reference count is > 1)
the M_TRAILINGSPACE and M_LEADINGSPACE(m)
must take into account that they cannot return the leading and trailing
space as free as they may be used by onother mbuf.
 
M_LEADINGSPACE(m) already has:
M_WRITABLE(m) ? (m)->m_data - (m)->m_ext.ext_buf : 0
but M_TRAILINGSPACE(m) does not.

so we cannot use the room in front of and after the data
unless the reference count == 1.









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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0205311218540.29361-100000>