Module Name:    src
Committed By:   martin
Date:           Mon Feb  9 09:46:01 UTC 2015

Modified Files:
        src/sys/kern [netbsd-7]: uipc_mbuf.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #501):
        sys/kern/uipc_mbuf.c: revision 1.161
Correct m_len calculation for m_dup() with mbuf clusters.
Fixes kern/49650.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.158.4.1 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.158 src/sys/kern/uipc_mbuf.c:1.158.4.1
--- src/sys/kern/uipc_mbuf.c:1.158	Tue Feb 25 18:30:11 2014
+++ src/sys/kern/uipc_mbuf.c	Mon Feb  9 09:46:01 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.158 2014/02/25 18:30:11 pooka Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1 2015/02/09 09:46:01 martin 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.158 2014/02/25 18:30:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.1 2015/02/09 09:46:01 martin Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_nmbclusters.h"
@@ -777,8 +777,13 @@ m_copym0(struct mbuf *m, int off0, int l
 				/*
 				 * we are unsure about the way m was allocated.
 				 * copy into multiple MCLBYTES cluster mbufs.
+				 *
+				 * recompute m_len, it is no longer valid if MCLGET()
+				 * fails to allocate a cluster. Then we try to split
+				 * the source into normal sized mbufs.
 				 */
 				MCLGET(n, wait);
+				n->m_len = 0;
 				n->m_len = M_TRAILINGSPACE(n);
 				n->m_len = m_copylen(len, n->m_len);
 				n->m_len = min(n->m_len, m->m_len - off);

Reply via email to