Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Revert v1.157



details:   https://anonhg.NetBSD.org/src/rev/67eb99a2966d
branches:  trunk
changeset: 348542:67eb99a2966d
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Oct 24 03:19:07 2016 +0000

description:
Revert v1.157

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

diffstat:

 sys/net/route.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r d589b70fdf4e -r 67eb99a2966d sys/net/route.c
--- a/sys/net/route.c   Mon Oct 24 03:02:48 2016 +0000
+++ b/sys/net/route.c   Mon Oct 24 03:19:07 2016 +0000
@@ -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 @@
 {
        int error;
        struct rt_addrinfo info;
+       struct rtentry *retrt;
 
        /*
         * Request the new route so that the entry is not actually
@@ -616,10 +617,12 @@
        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;
 }
 



Home | Main Index | Thread Index | Old Index