Module Name:    src
Committed By:   ozaki-r
Date:           Sun Dec 11 07:35:42 UTC 2016

Modified Files:
        src/sys/netinet6: icmp6.c

Log Message:
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)


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/sys/netinet6/icmp6.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/netinet6/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.201 src/sys/netinet6/icmp6.c:1.202
--- src/sys/netinet6/icmp6.c:1.201	Tue Nov 15 20:50:28 2016
+++ src/sys/netinet6/icmp6.c	Sun Dec 11 07:35:42 2016
@@ -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 @@ icmp6_redirect_output(struct mbuf *m0, s
 		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:

Reply via email to