Source-Changes-HG archive

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

[src/trunk]: src/sys/net Fix a ifa_release() leak for a specific struct rt_ad...



details:   https://anonhg.NetBSD.org/src/rev/2ed1642eb046
branches:  trunk
changeset: 454860:2ed1642eb046
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Mon Sep 30 10:22:14 2019 +0000

description:
Fix a ifa_release() leak for a specific struct rt_addrinfo.

ok by ozaki-r@n.o

diffstat:

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

diffs (31 lines):

diff -r 948ba9635ea3 -r 2ed1642eb046 sys/net/route.c
--- a/sys/net/route.c   Mon Sep 30 08:40:20 2019 +0000
+++ b/sys/net/route.c   Mon Sep 30 10:22:14 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.223 2019/09/25 09:53:37 ozaki-r Exp $      */
+/*     $NetBSD: route.c,v 1.224 2019/09/30 10:22:14 knakahara 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.223 2019/09/25 09:53:37 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.224 2019/09/30 10:22:14 knakahara Exp $");
 
 #include <sys/param.h>
 #ifdef RTFLUSH_DEBUG
@@ -1400,8 +1400,11 @@
                *ifp = ifa->ifa_ifp;
                if_acquire(*ifp, psref_ifp);
                if (info->rti_info[RTAX_IFA] == NULL &&
-                   info->rti_info[RTAX_GATEWAY] == NULL)
+                   info->rti_info[RTAX_GATEWAY] == NULL) {
+                       ifa_release(ifa, psref);
+                       ifa = NULL;
                        goto next;
+               }
                ifa_release(ifa, psref);
                if (info->rti_info[RTAX_IFA] == NULL) {
                        /* route change <dst> <gw> -ifp <if> */



Home | Main Index | Thread Index | Old Index