Module Name: src
Committed By: ozaki-r
Date: Fri Feb 10 13:44:47 UTC 2017
Modified Files:
src/sys/net: route.c
Log Message:
Fix locking against myself in ifa_ifwithroute_psref
It happened on the path: rtrequest1 => rt_getifa => ifa_ifwithroute_psref.
Reported by ryo@
To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 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.188 src/sys/net/route.c:1.189
--- src/sys/net/route.c:1.188 Thu Jan 19 06:58:55 2017
+++ src/sys/net/route.c Fri Feb 10 13:44:47 2017
@@ -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 @@ ifa_ifwithroute_psref(int flags, const s
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;
/*