Module Name: src
Committed By: maxv
Date: Tue Apr 17 06:23:30 UTC 2018
Modified Files:
src/sys/netipsec: ipsec_mbuf.c
Log Message:
Don't assume M_PKTHDR is set only on the first mbuf of the chain. It
should, but it looks like there are several places that can put M_PKTHDR
on secondary mbufs (PR/53189), so drop this assumption right now to
prevent further bugs.
The check is replaced by (m1 != m), which is equivalent to the previous
code: we want to modify m->m_pkthdr.len only when 'm' was not passed in
m_adj().
To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/netipsec/ipsec_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/netipsec/ipsec_mbuf.c
diff -u src/sys/netipsec/ipsec_mbuf.c:1.22 src/sys/netipsec/ipsec_mbuf.c:1.23
--- src/sys/netipsec/ipsec_mbuf.c:1.22 Sat Mar 10 17:52:50 2018
+++ src/sys/netipsec/ipsec_mbuf.c Tue Apr 17 06:23:30 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec_mbuf.c,v 1.22 2018/03/10 17:52:50 maxv Exp $ */
+/* $NetBSD: ipsec_mbuf.c,v 1.23 2018/04/17 06:23:30 maxv Exp $ */
/*
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.22 2018/03/10 17:52:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.23 2018/04/17 06:23:30 maxv Exp $");
/*
* IPsec-specific mbuf routines.
@@ -400,7 +400,7 @@ m_striphdr(struct mbuf *m, int skip, int
/* The header was at the beginning of the mbuf */
IPSEC_STATINC(IPSEC_STAT_INPUT_FRONT);
m_adj(m1, hlen);
- if ((m1->m_flags & M_PKTHDR) == 0)
+ if (m1 != m)
m->m_pkthdr.len -= hlen;
} else if (roff + hlen >= m1->m_len) {
struct mbuf *mo;
@@ -425,7 +425,7 @@ m_striphdr(struct mbuf *m, int skip, int
/* ...and trim the end of the first part of the chain...sick */
m_adj(m1, -(m1->m_len - roff));
- if ((m1->m_flags & M_PKTHDR) == 0)
+ if (m1 != m)
m->m_pkthdr.len -= (m1->m_len - roff);
/* Finally, let's relink */