diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-09-01 18:32:17 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-09-01 18:32:17 +0000 |
| commit | 9f276ea35def5aae808bb79ca704cd4bd3b3a76d (patch) | |
| tree | fc2eaa5d843612e880cb4c899b5d265bc6d76f3a /sys/netinet6 | |
| parent | 6a2ba3a0b61fbd4eb290f141aa2667f8de22df60 (diff) | |
nd6: Take ifnet psref around cprng_fast in nd6_slowtimo.
This may sleep on an adpative mutex, the global entropy lock, so
pserialize is forbidden.
Diffstat (limited to 'sys/netinet6')
| -rw-r--r-- | sys/netinet6/nd6.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index b6241e98e44..86f1ad05a6f 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $NetBSD: nd6.c,v 1.278 2021/12/31 12:41:50 andvar Exp $ */ +/* $NetBSD: nd6.c,v 1.279 2022/09/01 18:32:17 riastradh Exp $ */ /* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.278 2021/12/31 12:41:50 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.279 2022/09/01 18:32:17 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1534,6 +1534,7 @@ nd6_slowtimo(void *ignored_arg) { struct nd_kifinfo *ndi; struct ifnet *ifp; + struct psref psref; int s; SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE(); @@ -1545,6 +1546,8 @@ nd6_slowtimo(void *ignored_arg) ndi = ND_IFINFO(ifp); if (ndi->basereachable && /* already initialized */ (ndi->recalctm -= ND6_SLOWTIMER_INTERVAL) <= 0) { + if_acquire(ifp, &psref); + pserialize_read_exit(s); /* * Since reachable time rarely changes by router * advertisements, we SHOULD insure that a new random @@ -1553,6 +1556,8 @@ nd6_slowtimo(void *ignored_arg) */ ndi->recalctm = nd6_recalc_reachtm_interval; ndi->reachable = ND_COMPUTE_RTIME(ndi->basereachable); + s = pserialize_read_enter(); + if_release(ifp, &psref); } } pserialize_read_exit(s); |
