Module Name: src
Committed By: ozaki-r
Date: Thu Sep 3 00:54:39 UTC 2015
Modified Files:
src/sys/netinet6: nd6.c
Log Message:
Fix rtfree in nd6_output
We have to check and avoid to rtfree the original rtentry passed to
nd6_output even when manipulating gateway routes.
This fixes panic on assertion "ro->_ro_rt ==NULL || ro->_ro_rt->rt_refcnt > 0"
failure and probably PR kern/50161.
To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/sys/netinet6/nd6.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/nd6.c
diff -u src/sys/netinet6/nd6.c:1.174 src/sys/netinet6/nd6.c:1.175
--- src/sys/netinet6/nd6.c:1.174 Wed Sep 2 11:35:11 2015
+++ src/sys/netinet6/nd6.c Thu Sep 3 00:54:39 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.c,v 1.174 2015/09/02 11:35:11 ozaki-r Exp $ */
+/* $NetBSD: nd6.c,v 1.175 2015/09/03 00:54:39 ozaki-r Exp $ */
/* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.174 2015/09/02 11:35:11 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.175 2015/09/03 00:54:39 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -2212,12 +2212,12 @@ nd6_output(struct ifnet *ifp, struct ifn
RTFREE_IF_NEEDED(rt);
rt = gwrt;
if ((rt->rt_flags & RTF_UP) == 0) {
- rtfree(rt);
+ RTFREE_IF_NEEDED(rt);
rt = rt0;
lookup:
gwrt = rtalloc1(rt->rt_gateway, 1);
rt_set_gwroute(rt, gwrt);
- rtfree(rt);
+ RTFREE_IF_NEEDED(rt);
rt = gwrt;
if (rt == NULL)
senderr(EHOSTUNREACH);