From a9dcd320ab6cb469081bf458cc0743f9a547a558 Mon Sep 17 00:00:00 2001 From: maxv Date: Thu, 3 May 2018 07:46:17 +0000 Subject: [PATCH] Revert my rev1.190, remove the M_READONLY check. The initial code was correct: what is read-only is the mbuf storage, not the mbuf itself. The storage contains the packet payload, and never has anything related to mbufs. So it is fine to remove M_PKTHDR on mbufs that have a read-only storage. In fact it was kind of obvious, since several places already manually remove M_PKTHDR without taking care of the external storage. --- sys/kern/uipc_mbuf.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 29416091f304..d08519a9aaa9 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_mbuf.c,v 1.213 2018/05/03 07:25:50 maxv Exp $ */ +/* $NetBSD: uipc_mbuf.c,v 1.214 2018/05/03 07:46:17 maxv Exp $ */ /* * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.213 2018/05/03 07:25:50 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.214 2018/05/03 07:46:17 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_mbuftrace.h" @@ -1538,11 +1538,6 @@ m_remove_pkthdr(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));