git: 3e4aeeb95df2 - stable/13 - m_dup: Handle unmapped mbufs as an input mbuf.

John Baldwin jhb at FreeBSD.org
Wed Aug 11 21:14:02 UTC 2021


The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=3e4aeeb95df217fdd9ec21e5a86ec61d1b2abc59

commit 3e4aeeb95df217fdd9ec21e5a86ec61d1b2abc59
Author:     John Baldwin <jhb at FreeBSD.org>
AuthorDate: 2021-07-26 21:03:28 +0000
Commit:     John Baldwin <jhb at FreeBSD.org>
CommitDate: 2021-08-11 19:18:46 +0000

    m_dup: Handle unmapped mbufs as an input mbuf.
    
    Use m_copydata() instead of a direct bcopy() when copying data out of
    a source mbuf into a newly-allocated mbuf.
    
    PR:           256610
    Reported by:  Niels Bakker <niels=freebsd at bakker.net>
    Reviewed by:  markj
    MFC after:    2 weeks
    
    (cherry picked from commit be79f30d6c3e353856d4f82227b270abc26be702)
---
 sys/kern/uipc_mbuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index f7852bc7dd7f..f525c25d1431 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -719,7 +719,7 @@ m_dup(const struct mbuf *m, int how)
 		while (n->m_len < nsize && m != NULL) {
 			int chunk = min(nsize - n->m_len, m->m_len - moff);
 
-			bcopy(m->m_data + moff, n->m_data + n->m_len, chunk);
+			m_copydata(m, moff, chunk, n->m_data + n->m_len);
 			moff += chunk;
 			n->m_len += chunk;
 			remain -= chunk;


More information about the dev-commits-src-branches mailing list