Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Correct sanity checks of icmp6_redirect_output
details: https://anonhg.NetBSD.org/src/rev/b4c898165231
branches: trunk
changeset: 819605:b4c898165231
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Sun Dec 11 07:35:42 2016 +0000
description:
Correct sanity checks of icmp6_redirect_output
- rt->rt_ifp is always non-NULL
- Checking RTF_UP here is just racy and meaningless
- The arguments should be non-NULL (at least for now)
diffstat:
sys/netinet6/icmp6.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (31 lines):
diff -r c23be069ee9d -r b4c898165231 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c Sun Dec 11 07:34:14 2016 +0000
+++ b/sys/netinet6/icmp6.c Sun Dec 11 07:35:42 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: icmp6.c,v 1.201 2016/11/15 20:50:28 mlelstv Exp $ */
+/* $NetBSD: icmp6.c,v 1.202 2016/12/11 07:35:42 ozaki-r 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.201 2016/11/15 20:50:28 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.202 2016/12/11 07:35:42 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -2421,8 +2421,10 @@
goto fail;
/* sanity check */
- if (!m0 || !rt || !(rt->rt_flags & RTF_UP) || !(ifp = rt->rt_ifp))
- goto fail;
+ KASSERT(m0 != NULL);
+ KASSERT(rt != NULL);
+
+ ifp = rt->rt_ifp;
/*
* Address check:
Home |
Main Index |
Thread Index |
Old Index