Always use m_split() in m_copyback() instead of its
local, abridged, version. This closes a window where a new mbuf (n) can be inserted where n->m_next == n.
This commit is contained in:
parent
407cdd8a24
commit
49025bce19
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: uipc_mbuf.c,v 1.136 2010/05/11 20:21:56 pooka Exp $ */
|
||||
/* $NetBSD: uipc_mbuf.c,v 1.137 2010/10/28 14:21:50 seanb Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
|
||||
@ -62,7 +62,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.136 2010/05/11 20:21:56 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.137 2010/10/28 14:21:50 seanb Exp $");
|
||||
|
||||
#include "opt_mbuftrace.h"
|
||||
#include "opt_nmbclusters.h"
|
||||
@ -1346,7 +1346,7 @@ extend:
|
||||
* if we're going to write into the middle of
|
||||
* a mbuf, split it first.
|
||||
*/
|
||||
if (off > 0 && len < mlen) {
|
||||
if (off > 0) {
|
||||
n = m_split0(m, off, how, 0);
|
||||
if (n == NULL)
|
||||
goto enobufs;
|
||||
@ -1390,19 +1390,6 @@ extend:
|
||||
else
|
||||
datap = NULL;
|
||||
eatlen = n->m_len;
|
||||
KDASSERT(off == 0 || eatlen >= mlen);
|
||||
if (off > 0) {
|
||||
KDASSERT(len >= mlen);
|
||||
m->m_len = off;
|
||||
m->m_next = n;
|
||||
if (datap) {
|
||||
m_copydata(m, off, mlen, datap);
|
||||
datap += mlen;
|
||||
}
|
||||
eatlen -= mlen;
|
||||
mp = &m->m_next;
|
||||
m = m->m_next;
|
||||
}
|
||||
while (m != NULL && M_READONLY(m) &&
|
||||
n->m_type == m->m_type && eatlen > 0) {
|
||||
mlen = min(eatlen, m->m_len);
|
||||
|
Loading…
Reference in New Issue
Block a user