Date: Sun, 8 Jan 2017 18:46:01 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311695 - head/sys/netinet6 Message-ID: <201701081846.v08Ik1Ff022729@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Sun Jan 8 18:46:00 2017 New Revision: 311695 URL: https://svnweb.freebsd.org/changeset/base/311695 Log: Release the ND6 list lock before making a prefix off-link in nd6_timer(). Reported by: Jim <BM-2cWfdfG5CJsquqkJyry7hZT9LypbSEWEkQ@bitmessage.ch> X-MFC With: r306829 Modified: head/sys/netinet6/nd6.c Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sun Jan 8 18:33:13 2017 (r311694) +++ head/sys/netinet6/nd6.c Sun Jan 8 18:46:00 2017 (r311695) @@ -910,7 +910,7 @@ nd6_timer(void *arg) struct nd_defrouter *dr, *ndr; struct nd_prefix *pr, *npr; struct in6_ifaddr *ia6, *nia6; - bool onlink_locked; + uint64_t genid; TAILQ_INIT(&drq); LIST_INIT(&prl); @@ -1022,7 +1022,6 @@ nd6_timer(void *arg) } ND6_WLOCK(); - onlink_locked = false; restart: LIST_FOREACH_SAFE(pr, &V_nd_prefix, ndpr_entry, npr) { /* @@ -1045,22 +1044,19 @@ restart: continue; } if ((pr->ndpr_stateflags & NDPRF_ONLINK) != 0) { - if (!onlink_locked) { - onlink_locked = ND6_ONLINK_TRYLOCK(); - if (!onlink_locked) { - ND6_WUNLOCK(); - ND6_ONLINK_LOCK(); - onlink_locked = true; - ND6_WLOCK(); - goto restart; - } - } + genid = V_nd6_list_genid; + nd6_prefix_ref(pr); + ND6_WUNLOCK(); + ND6_ONLINK_LOCK(); (void)nd6_prefix_offlink(pr); + ND6_ONLINK_UNLOCK(); + ND6_WLOCK(); + nd6_prefix_rele(pr); + if (genid != V_nd6_list_genid) + goto restart; } } ND6_WUNLOCK(); - if (onlink_locked) - ND6_ONLINK_UNLOCK(); while ((pr = LIST_FIRST(&prl)) != NULL) { LIST_REMOVE(pr, ndpr_entry);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701081846.v08Ik1Ff022729>