mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-13 14:40:22 +00:00
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
This commit is contained in:
parent
647501a046
commit
fef82663b8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107297
@ -1192,6 +1192,7 @@ m_getm(struct mbuf *m, int len, int how, short type)
|
|||||||
if (mb == NULL)
|
if (mb == NULL)
|
||||||
goto failed;
|
goto failed;
|
||||||
_mb_setup(mb, type);
|
_mb_setup(mb, type);
|
||||||
|
mb->m_len = 0;
|
||||||
|
|
||||||
persist = (i != (num - 1) || rem > 0) ? MBP_PERSIST : 0;
|
persist = (i != (num - 1) || rem > 0) ? MBP_PERSIST : 0;
|
||||||
mb->m_ext.ext_buf = (caddr_t)mb_alloc(&mb_list_clust,
|
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)
|
if (cur == NULL)
|
||||||
top = cur = mb;
|
top = cur = mb;
|
||||||
else
|
else
|
||||||
cur->m_next = mb;
|
cur = (cur->m_next = mb);
|
||||||
}
|
}
|
||||||
if (rem > 0) {
|
if (rem > 0) {
|
||||||
if (cchnum >= 0) {
|
if (cchnum >= 0) {
|
||||||
@ -1222,6 +1223,7 @@ m_getm(struct mbuf *m, int len, int how, short type)
|
|||||||
mb = m_get(how, type);
|
mb = m_get(how, type);
|
||||||
}
|
}
|
||||||
if (mb != NULL) {
|
if (mb != NULL) {
|
||||||
|
mb->m_len = 0;
|
||||||
if (cur == NULL)
|
if (cur == NULL)
|
||||||
top = mb;
|
top = mb;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user