Date: Tue, 31 Jan 2006 14:29:02 +0100 From: Andre Oppermann <andre@freebsd.org> To: JINMEI@freebsd.org Cc: freebsd-net@freebsd.org Subject: Re: m_tag leak? Message-ID: <43DF661E.8A08C7EF@freebsd.org> References: <y7vlkwweek0.wl%jinmei@isl.rdc.toshiba.co.jp>
next in thread | previous in thread | raw e-mail | index | archive | help
JINMEI Tatuya / 神明達哉 wrote:
>
> While tracking a different issue, I felt I just got confused. From a
> very quick look at m_freem() and m_free(), it looks there is a leakage
> of m_tag. This is the definition of m_freem() in rev. 1.160 of
> uipc_mbuf.c:
>
> void
> m_freem(struct mbuf *mb)
> {
>
> while (mb != NULL)
> mb = m_free(mb);
> }
>
> And the following is the definition of m_free() (defined in
> sys/mbuf.h, rev 1.187)
>
> static __inline
> struct mbuf *
> m_free(struct mbuf *m)
> {
> struct mbuf *n = m->m_next;
>
> if (m->m_flags & M_EXT)
> mb_free_ext(m);
> else
> uma_zfree(zone_mbuf, m);
> return n;
> }
>
> Doesn't this mean an m_tag attached to the mbuf to be freed, if any,
> will remain without any reference? Perhaps I'm missing something very
> trivial. It would be appreciated if someone could clarify that.
This is indeed non-obvious and scattered around but happens correctly.
Have a look at kern/kern_mbuf.c:mb_dtor_mbuf().
--
Andre
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43DF661E.8A08C7EF>
