From owner-svn-src-head@freebsd.org Sun Jan 8 18:46:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A1ACCA59A7; Sun, 8 Jan 2017 18:46:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D54D815EA; Sun, 8 Jan 2017 18:46:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v08Ik10j022730; Sun, 8 Jan 2017 18:46:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v08Ik1Ff022729; Sun, 8 Jan 2017 18:46:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201701081846.v08Ik1Ff022729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Jan 2017 18:46:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311695 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jan 2017 18:46:02 -0000 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 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);