Module Name: src Committed By: ozaki-r Date: Tue Aug 14 01:10:58 UTC 2018
Modified Files: src/sys/netinet6: nd6_rtr.c Log Message: Don't call find_pfxlist_reachable_router, which may sleep, in a pserialize read section Found by knakahara@ To generate a diff of this commit: cvs rdiff -u -r1.143 -r1.144 src/sys/netinet6/nd6_rtr.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/netinet6/nd6_rtr.c diff -u src/sys/netinet6/nd6_rtr.c:1.143 src/sys/netinet6/nd6_rtr.c:1.144 --- src/sys/netinet6/nd6_rtr.c:1.143 Sat May 19 08:22:58 2018 +++ src/sys/netinet6/nd6_rtr.c Tue Aug 14 01:10:58 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_rtr.c,v 1.143 2018/05/19 08:22:58 maxv Exp $ */ +/* $NetBSD: nd6_rtr.c,v 1.144 2018/08/14 01:10:58 ozaki-r Exp $ */ /* $KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.143 2018/05/19 08:22:58 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.144 2018/08/14 01:10:58 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -1586,6 +1586,7 @@ nd6_pfxlist_onlink_check(void) } } + int bound = curlwp_bind(); /* * Changes on the prefix status might affect address status as well. * Make sure that all addresses derived from an attached prefix are @@ -1596,6 +1597,9 @@ nd6_pfxlist_onlink_check(void) */ s = pserialize_read_enter(); IN6_ADDRLIST_READER_FOREACH(ia) { + struct psref psref; + bool found; + if (!(ia->ia6_flags & IN6_IFF_AUTOCONF)) continue; @@ -1608,14 +1612,19 @@ nd6_pfxlist_onlink_check(void) continue; } - if (find_pfxlist_reachable_router(ia->ia6_ndpr)) + ia6_acquire(ia, &psref); + pserialize_read_exit(s); + + found = find_pfxlist_reachable_router(ia->ia6_ndpr) != NULL; + + s = pserialize_read_enter(); + ia6_release(ia, &psref); + if (found) break; } pserialize_read_exit(s); if (ia) { - int bound = curlwp_bind(); - s = pserialize_read_enter(); IN6_ADDRLIST_READER_FOREACH(ia) { struct ifaddr *ifa = (struct ifaddr *)ia; @@ -1652,11 +1661,8 @@ nd6_pfxlist_onlink_check(void) ia6_release(ia, &psref); } pserialize_read_exit(s); - curlwp_bindx(bound); } else { - int bound = curlwp_bind(); - s = pserialize_read_enter(); IN6_ADDRLIST_READER_FOREACH(ia) { if ((ia->ia6_flags & IN6_IFF_AUTOCONF) == 0) @@ -1680,8 +1686,9 @@ nd6_pfxlist_onlink_check(void) } } pserialize_read_exit(s); - curlwp_bindx(bound); } + + curlwp_bindx(bound); } static int