FreeBSD Bugzilla – Attachment 146286 Details for
Bug 193005
[patch] m_copymdata() doesn't copy data properly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for the problems described in this bug.
m_copymdata.patch (text/plain), 1.81 KB, created by
keithr@freebsd.keithr.com
on 2014-08-26 02:27:40 UTC
(
hide
)
Description:
Patch for the problems described in this bug.
Filename:
MIME Type:
Creator:
keithr@freebsd.keithr.com
Created:
2014-08-26 02:27:40 UTC
Size:
1.81 KB
patch
obsolete
>diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c >index f9a0f3e0..d246cdc 100644 >--- a/sys/kern/uipc_mbuf.c >+++ b/sys/kern/uipc_mbuf.c >@@ -736,9 +736,12 @@ nospace: > */ > > static int >-m_bcopyxxx(void *s, void *t, u_int len) >+m_bcopyxxx(void *arg, void *src, u_int len) > { >- bcopy(s, t, (size_t)len); >+ struct mbuf *dst = arg; >+ >+ bcopy(src, mtod(dst, caddr_t) + dst->m_len, (size_t) len); >+ dst->m_len += len; > return 0; > } > >@@ -790,17 +793,16 @@ m_copymdata(struct mbuf *m, struct mbuf *n, int off, int len, > */ > /* Shortcut if enough free space in first/last mbuf. */ > if (!prep && M_TRAILINGSPACE(mm) >= len) { >- m_apply(n, off, len, m_bcopyxxx, mtod(mm, caddr_t) + >- mm->m_len); >- mm->m_len += len; >- mm->m_pkthdr.len += len; >+ m_apply(n, off, len, m_bcopyxxx, mm); >+ if (m->m_flags & M_PKTHDR) >+ m->m_pkthdr.len += len; > return m; > } > if (prep && M_LEADINGSPACE(mm) >= len) { > mm->m_data = mtod(mm, caddr_t) - len; >- m_apply(n, off, len, m_bcopyxxx, mtod(mm, caddr_t)); >- mm->m_len += len; >- mm->m_pkthdr.len += len; >+ m_apply(n, off, len, m_bcopyxxx, mm); >+ if (mm->m_flags & M_PKTHDR) >+ mm->m_pkthdr.len += len; > return mm; > } > >@@ -840,7 +842,8 @@ m_copymdata(struct mbuf *m, struct mbuf *n, int off, int len, > break; > } > z->m_data += i - len; >- m_move_pkthdr(mm, z); >+ if (z->m_flags & M_PKTHDR) >+ m_move_pkthdr(mm, z); > x->m_next = mm; > mm = z; > } >@@ -858,8 +861,7 @@ m_copymdata(struct mbuf *m, struct mbuf *n, int off, int len, > while (len > 0) { > KASSERT(z != NULL, ("m_copymdata, falling off target edge")); > i = M_TRAILINGSPACE(z); >- m_apply(n, off, i, m_bcopyxxx, mtod(z, caddr_t) + z->m_len); >- z->m_len += i; >+ m_apply(n, off, i, m_bcopyxxx, z); > /* fixup pkthdr.len if necessary */ > if ((prep ? mm : m)->m_flags & M_PKTHDR) > (prep ? mm : m)->m_pkthdr.len += i;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 193005
: 146286