Review needed: Mbuf double-free detection patch

Mike Silbersack silby at silby.com
Thu May 1 08:38:51 PDT 2003


On Thu, 1 May 2003, Luigi Rizzo wrote:

> as Bosko noticed, it would be a good idea to make the change to subr_mbuf.c
> conditionally compiled under DIAGNOSTIC or INVARIANTS or the like.

Hsu already convinced me to put it under INVARIANTS in private mail.

> I was actually wondering if you have caught already any bug
> with this code enabled.

Nope, not yet.  I was just trying to figure out how mbuf free list
corruption could occur, and a double-free seemed to be an obvious thing to
try.  Once I found how much it messed things up, I came up with this
patch.

> [on a side note, it is a bit depressing to see the same
> code replicated twice, in m_free() and m_freem(). Couldn't
> one try to make m_freem() just call m_free() in a loop and
> save some code bloat ? I doubt the extra function call
> would harm performance too much.]
>
> 	cheers
> 	luigi

Someone seems to have placed a SEP field around that paragraph, I'm having
trouble reading it. :)

Mike "Silby" Silbersack


More information about the freebsd-net mailing list