Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Apr 2015 11:11:58 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        freebsd-net@FreeBSD.org, Poul-Henning Kamp <phk@phk.freebsd.dk>
Subject:   should m_copyback possibly throw data away?
Message-ID:  <20150424181158.GJ37063@funkthat.com>

next in thread | raw e-mail | index | archive | help
I was reviewing m_copyback from some other code, and noticed that it does
this:
        if (m0 == NULL)
                return;

at the beginin... If you pass in a NULL mbuf, it will not copy any data
in..  This is clearly to avoid panics, but at the same time, this means
we'll have data loss...  If someone tried to copy into a NULL mbuf,
it's likely a bug, and papering over that bug doesn't seem wise...

I'd like to see that removed (or changed to a KASSERT), but as it's been
in there since 1994:
https://svnweb.freebsd.org/base/head/sys/kern/uipc_mbuf.c?r1=3351&r2=3352

That's a pretty fundamental change...  mbuf(9) does not document this
behavior that data may be thrown away...

I would also be fine w/ documenting this behavior, though I'm sure
it'd be surprising to many that you'd have to check to make sure your
data was properly copied.

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150424181158.GJ37063>