Subject: Re: disable m_dup()
To: Jun-ichiro itojun Hagino <itojun@iijlab.net>
From: Darren Reed <darrenr@reed.wattle.id.au>
List: tech-net
Date: 08/19/2000 00:11:52
In some email I received from Jun-ichiro itojun Hagino, sie wrote:
> 	i found rather serious false assumption in sys/kern/uipc_mbuf.c:m_dup().
> 	i would like to disable the function for safety (wrap by #if 0).
> 	are there anyone using the function?
> 
> 	the false assumption: if a mbuf has M_EXT bit raised,
> 	m_ext.ext_siz == MCLBYTES (cluster memory region allocated via MCLGET).
> 	the assumption does not hold

So are you saying that code like this is wrong ?

                MCLGET(m, M_DONTWAIT);
                if ((m->m_flags & M_EXT) == 0) {
                        m_freem(m);
                        return ENOBUFS;
                }
                avail = (m->m_flags & M_EXT) ? MCLBYTES : MHLEN;

If it is, what is correct here ?

Darren