Module Name:    src
Committed By:   martin
Date:           Tue Apr 17 08:30:08 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1598):

        sys/kern/uipc_mbuf.c: revision 1.190

If the mbuf is shared leave M_PKTHDR in place. Given where this function
is called from that's not supposed to happen, but I'm growing unconfident
about our mbuf code.


To generate a diff of this commit:
cvs rdiff -u -r1.158.4.1.2.1 -r1.158.4.1.2.2 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.4.1.2.1 src/sys/kern/uipc_mbuf.c:1.158.4.1.2.2
--- src/sys/kern/uipc_mbuf.c:1.158.4.1.2.1	Thu Apr  5 11:53:02 2018
+++ src/sys/kern/uipc_mbuf.c	Tue Apr 17 08:30:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.1 2018/04/05 11:53:02 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.2 2018/04/17 08:30:08 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.4.1.2.1 2018/04/05 11:53:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.2 2018/04/17 08:30:08 martin Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_nmbclusters.h"
@@ -458,6 +458,11 @@ m_pkthdr_remove(struct mbuf *m)
 {
 	KASSERT(m->m_flags & M_PKTHDR);
 
+	if (M_READONLY(m)) {
+		/* Nothing we can do. */
+		return;
+	}
+
 	m_tag_delete_chain(m, NULL);
 	m->m_flags &= ~M_PKTHDR;
 	memset(&m->m_pkthdr, 0, sizeof(m->m_pkthdr));

Reply via email to