Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Always use m_split() in m_copyback() instead of its



details:   https://anonhg.NetBSD.org/src/rev/17240c6290d6
branches:  trunk
changeset: 758245:17240c6290d6
user:      seanb <seanb%NetBSD.org@localhost>
date:      Thu Oct 28 14:21:50 2010 +0000

description:
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.

diffstat:

 sys/kern/uipc_mbuf.c |  19 +++----------------
 1 files changed, 3 insertions(+), 16 deletions(-)

diffs (47 lines):

diff -r 0322c9f4bb4a -r 17240c6290d6 sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c      Thu Oct 28 13:58:03 2010 +0000
+++ b/sys/kern/uipc_mbuf.c      Thu Oct 28 14:21:50 2010 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index