Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netipsec Do m_pullup before mtod
details: https://anonhg.NetBSD.org/src/rev/53dfcef32466
branches: trunk
changeset: 354290:53dfcef32466
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Sat Jun 10 14:21:01 2017 +0000
description:
Do m_pullup before mtod
It may fix panicks of some tests on anita/sparc and anita/GuruPlug.
diffstat:
sys/netipsec/key.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diffs (44 lines):
diff -r 1a2822d4dac7 -r 53dfcef32466 sys/netipsec/key.c
--- a/sys/netipsec/key.c Sat Jun 10 12:03:30 2017 +0000
+++ b/sys/netipsec/key.c Sat Jun 10 14:21:01 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: key.c,v 1.163 2017/06/02 03:32:51 ozaki-r Exp $ */
+/* $NetBSD: key.c,v 1.164 2017/06/10 14:21:01 ozaki-r Exp $ */
/* $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $ */
/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.163 2017/06/02 03:32:51 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.164 2017/06/10 14:21:01 ozaki-r Exp $");
/*
* This code is referd to RFC 2367
@@ -6016,6 +6016,12 @@
if (!m)
return NULL;
+ if (m->m_len < sizeof(struct sadb_comb)) {
+ m = m_pullup(m, sizeof(struct sadb_comb));
+ if (m == NULL)
+ return NULL;
+ }
+
comb = mtod(m, struct sadb_comb *);
memset(comb, 0, sizeof(*comb));
key_getcomb_setlifetime(comb);
@@ -6060,6 +6066,12 @@
if (!m)
return NULL;
+ if (m->m_len < sizeof(struct sadb_comb)) {
+ m = m_pullup(m, sizeof(struct sadb_comb));
+ if (m == NULL)
+ return NULL;
+ }
+
comb = mtod(m, struct sadb_comb *);
memset(comb, 0, sizeof(*comb));
key_getcomb_setlifetime(comb);
Home |
Main Index |
Thread Index |
Old Index