Module Name: src Committed By: seanb Date: Thu Oct 28 14:21:51 UTC 2010
Modified Files: src/sys/kern: uipc_mbuf.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.136 -r1.137 src/sys/kern/uipc_mbuf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/uipc_mbuf.c diff -u src/sys/kern/uipc_mbuf.c:1.136 src/sys/kern/uipc_mbuf.c:1.137 --- src/sys/kern/uipc_mbuf.c:1.136 Tue May 11 20:21:56 2010 +++ src/sys/kern/uipc_mbuf.c Thu Oct 28 14:21:50 2010 @@ -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 @@ * 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 @@ 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);