summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_mbuf.c
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2006-12-21 19:58:04 +0000
committerrrs <rrs@FreeBSD.org>2006-12-21 19:58:04 +0000
commitc427816562e439f54793d30e6f0e60444b39fd5c (patch)
treea3f5c2f693a1ae647958fbbf316232b4837e69c6 /sys/kern/uipc_mbuf.c
parentc1ad055a2e7a497b485b197df17c0dab46449c9d (diff)
downloadFreeBSD-src-c427816562e439f54793d30e6f0e60444b39fd5c.zip
FreeBSD-src-c427816562e439f54793d30e6f0e60444b39fd5c.tar.gz
The prepend function did not handle non-pkthdr's correctly.
It always called MH_ALIGN for small lengths being prepended (less than MHLEN). This meant that if you did a prepend on a non M_PKTHDR the system would panic with the KASSERT in MH_ALIGN. Instead we are not aware of this and do a MH_ALIGN or M_ALIGN as appropriate. Reviewed by: andre Approved by: gnn
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r--sys/kern/uipc_mbuf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 3a4fb4c..4161ac8 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -496,8 +496,13 @@ m_prepend(struct mbuf *m, int len, int how)
M_MOVE_PKTHDR(mn, m);
mn->m_next = m;
m = mn;
- if (len < MHLEN)
- MH_ALIGN(m, len);
+ if(m->m_flags & M_PKTHDR) {
+ if (len < MHLEN)
+ MH_ALIGN(m, len);
+ } else {
+ if (len < MLEN)
+ M_ALIGN(m, len);
+ }
m->m_len = len;
return (m);
}
OpenPOWER on IntegriCloud