Module Name:    src
Committed By:   ozaki-r
Date:           Mon Oct 24 03:19:07 UTC 2016

Modified Files:
        src/sys/net: route.c

Log Message:
Revert v1.157

We need to hold the rtentry over rtrequest1 for info that dereferences
member variables of the rtentry after rtrequest1.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/net/route.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/net/route.c
diff -u src/sys/net/route.c:1.179 src/sys/net/route.c:1.180
--- src/sys/net/route.c:1.179	Fri Oct 21 10:56:35 2016
+++ src/sys/net/route.c	Mon Oct 24 03:19:07 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.179 2016/10/21 10:56:35 ozaki-r Exp $	*/
+/*	$NetBSD: route.c,v 1.180 2016/10/24 03:19:07 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.179 2016/10/21 10:56:35 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.180 2016/10/24 03:19:07 ozaki-r Exp $");
 
 #include <sys/param.h>
 #ifdef RTFLUSH_DEBUG
@@ -605,6 +605,7 @@ rtdeletemsg(struct rtentry *rt)
 {
 	int error;
 	struct rt_addrinfo info;
+	struct rtentry *retrt;
 
 	/*
 	 * Request the new route so that the entry is not actually
@@ -616,10 +617,12 @@ rtdeletemsg(struct rtentry *rt)
 	info.rti_info[RTAX_NETMASK] = rt_mask(rt);
 	info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
 	info.rti_flags = rt->rt_flags;
-	error = rtrequest1(RTM_DELETE, &info, NULL);
+	error = rtrequest1(RTM_DELETE, &info, &retrt);
 
 	rt_missmsg(RTM_DELETE, &info, info.rti_flags, error);
 
+	if (error == 0)
+		rtfree(retrt);
 	return error;
 }
 

Reply via email to