Use M_UNWRITABLE, no functional change.
This commit is contained in:
parent
1cf079b88f
commit
e64bc0451a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ip_icmp.c,v 1.168 2018/02/08 09:32:02 maxv Exp $ */
|
||||
/* $NetBSD: ip_icmp.c,v 1.169 2018/04/26 07:28:21 maxv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
|
||||
@ -94,7 +94,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.168 2018/02/08 09:32:02 maxv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.169 2018/04/26 07:28:21 maxv Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_ipsec.h"
|
||||
@ -448,7 +448,7 @@ _icmp_input(struct mbuf *m, int hlen, int proto)
|
||||
goto freeit;
|
||||
}
|
||||
i = hlen + min(icmplen, ICMP_ADVLENMIN);
|
||||
if ((m->m_len < i || M_READONLY(m)) && (m = m_pullup(m, i)) == NULL) {
|
||||
if (M_UNWRITABLE(m, i) && (m = m_pullup(m, i)) == NULL) {
|
||||
ICMP_STATINC(ICMP_STAT_TOOSHORT);
|
||||
return;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: icmp6.c,v 1.230 2018/04/14 17:55:47 maxv Exp $ */
|
||||
/* $NetBSD: icmp6.c,v 1.231 2018/04/26 07:28:21 maxv Exp $ */
|
||||
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
|
||||
|
||||
/*
|
||||
@ -62,7 +62,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.230 2018/04/14 17:55:47 maxv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.231 2018/04/26 07:28:21 maxv Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
@ -642,8 +642,7 @@ _icmp6_input(struct mbuf *m, int off, int proto)
|
||||
/* Give up local */
|
||||
n = m;
|
||||
m = NULL;
|
||||
} else if (M_READONLY(n) ||
|
||||
n->m_len < off + sizeof(struct icmp6_hdr)) {
|
||||
} else if (M_UNWRITABLE(n, off + sizeof(struct icmp6_hdr))) {
|
||||
struct mbuf *n0 = n;
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ip6_mroute.c,v 1.123 2018/03/21 14:23:54 roy Exp $ */
|
||||
/* $NetBSD: ip6_mroute.c,v 1.124 2018/04/26 07:28:21 maxv Exp $ */
|
||||
/* $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $ */
|
||||
|
||||
/*
|
||||
@ -117,7 +117,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.123 2018/03/21 14:23:54 roy Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.124 2018/04/26 07:28:21 maxv Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
@ -1131,8 +1131,7 @@ ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m)
|
||||
* Pullup packet header if needed before storing it,
|
||||
* as other references may modify it in the meantime.
|
||||
*/
|
||||
if (mb0 &&
|
||||
(M_READONLY(mb0) || mb0->m_len < sizeof(struct ip6_hdr)))
|
||||
if (mb0 && M_UNWRITABLE(mb0, sizeof(struct ip6_hdr)))
|
||||
mb0 = m_pullup(mb0, sizeof(struct ip6_hdr));
|
||||
if (mb0 == NULL) {
|
||||
free(rte, M_MRTABLE);
|
||||
@ -1416,9 +1415,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt)
|
||||
struct omrt6msg *oim;
|
||||
|
||||
mm = m_copy(m, 0, sizeof(struct ip6_hdr));
|
||||
if (mm &&
|
||||
(M_READONLY(mm) ||
|
||||
mm->m_len < sizeof(struct ip6_hdr)))
|
||||
if (mm && M_UNWRITABLE(mm, sizeof(struct ip6_hdr)))
|
||||
mm = m_pullup(mm, sizeof(struct ip6_hdr));
|
||||
if (mm == NULL)
|
||||
return ENOBUFS;
|
||||
@ -1552,8 +1549,7 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m)
|
||||
* so that ip6_output() only scribbles on the copy.
|
||||
*/
|
||||
mb_copy = m_copy(m, 0, M_COPYALL);
|
||||
if (mb_copy &&
|
||||
(M_READONLY(mb_copy) || mb_copy->m_len < sizeof(struct ip6_hdr)))
|
||||
if (mb_copy && M_UNWRITABLE(mb_copy, sizeof(struct ip6_hdr)))
|
||||
mb_copy = m_pullup(mb_copy, sizeof(struct ip6_hdr));
|
||||
if (mb_copy == NULL) {
|
||||
splx(s);
|
||||
|
Loading…
Reference in New Issue
Block a user