diff options
author | tjr <tjr@FreeBSD.org> | 2002-11-27 04:26:00 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-11-27 04:26:00 +0000 |
commit | 857f556917861ac978f071faa1af8aa6e5b2918a (patch) | |
tree | ef3416ecfb08072806c346023d6d6313a58b1196 /sys/kern/subr_mbuf.c | |
parent | 0d50dd2183c2aa653f3dcba7855f40ef7af83386 (diff) | |
download | FreeBSD-src-857f556917861ac978f071faa1af8aa6e5b2918a.zip FreeBSD-src-857f556917861ac978f071faa1af8aa6e5b2918a.tar.gz |
o Initialise each mbuf's m_len to 0 in m_getm(); mb_put_mem() depends
on this.
o Update the `cur' pointer in the cluster loop in m_getm() to avoid
incorrect truncation and leaked mbufs.
Reviewed by: bmilekic
Approved by: re
Diffstat (limited to 'sys/kern/subr_mbuf.c')
-rw-r--r-- | sys/kern/subr_mbuf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/subr_mbuf.c b/sys/kern/subr_mbuf.c index fb0d626..02ad99a 100644 --- a/sys/kern/subr_mbuf.c +++ b/sys/kern/subr_mbuf.c @@ -1192,6 +1192,7 @@ m_getm(struct mbuf *m, int len, int how, short type) if (mb == NULL) goto failed; _mb_setup(mb, type); + mb->m_len = 0; persist = (i != (num - 1) || rem > 0) ? MBP_PERSIST : 0; mb->m_ext.ext_buf = (caddr_t)mb_alloc(&mb_list_clust, @@ -1207,7 +1208,7 @@ m_getm(struct mbuf *m, int len, int how, short type) if (cur == NULL) top = cur = mb; else - cur->m_next = mb; + cur = (cur->m_next = mb); } if (rem > 0) { if (cchnum >= 0) { @@ -1222,6 +1223,7 @@ m_getm(struct mbuf *m, int len, int how, short type) mb = m_get(how, type); } if (mb != NULL) { + mb->m_len = 0; if (cur == NULL) top = mb; else |