Source-Changes-HG archive

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

[src/trunk]: src/sys/kern If the mbuf is shared leave M_PKTHDR in place. Give...



details:   https://anonhg.NetBSD.org/src/rev/04c1d75b3380
branches:  trunk
changeset: 361196:04c1d75b3380
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Apr 17 07:41:34 2018 +0000

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

diffstat:

 sys/kern/uipc_mbuf.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 0c67ffac1a57 -r 04c1d75b3380 sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c      Tue Apr 17 06:23:30 2018 +0000
+++ b/sys/kern/uipc_mbuf.c      Tue Apr 17 07:41:34 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_mbuf.c,v 1.189 2018/04/16 19:19:51 maxv Exp $     */
+/*     $NetBSD: uipc_mbuf.c,v 1.190 2018/04/17 07:41:34 maxv 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.189 2018/04/16 19:19:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.190 2018/04/17 07:41:34 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -460,6 +460,11 @@
 {
        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));



Home | Main Index | Thread Index | Old Index