Source-Changes-HG archive

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

[src/trunk]: src/sys/net Fix locking against myself in ifa_ifwithroute_psref



details:   https://anonhg.NetBSD.org/src/rev/2ac4344b7a39
branches:  trunk
changeset: 351345:2ac4344b7a39
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Feb 10 13:44:47 2017 +0000

description:
Fix locking against myself in ifa_ifwithroute_psref

It happened on the path: rtrequest1 => rt_getifa => ifa_ifwithroute_psref.

Reported by ryo@

diffstat:

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

diffs (31 lines):

diff -r 19441ee072c9 -r 2ac4344b7a39 sys/net/route.c
--- a/sys/net/route.c   Fri Feb 10 10:39:36 2017 +0000
+++ b/sys/net/route.c   Fri Feb 10 13:44:47 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.188 2017/01/19 06:58:55 ozaki-r Exp $      */
+/*     $NetBSD: route.c,v 1.189 2017/02/10 13:44:47 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.188 2017/01/19 06:58:55 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.189 2017/02/10 13:44:47 ozaki-r Exp $");
 
 #include <sys/param.h>
 #ifdef RTFLUSH_DEBUG
@@ -1012,7 +1012,11 @@
                int s;
                struct rtentry *rt;
 
-               rt = rtalloc1(dst, 0);
+               /* XXX we cannot call rtalloc1 if holding the rt lock */
+               if (RT_LOCKED())
+                       rt = rtalloc1_locked(dst, 0, true);
+               else
+                       rt = rtalloc1(dst, 0);
                if (rt == NULL)
                        return NULL;
                /*



Home | Main Index | Thread Index | Old Index