From owner-svn-src-stable@FreeBSD.ORG Fri Dec 10 15:37:55 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E6C61065697; Fri, 10 Dec 2010 15:37:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02EFB8FC21; Fri, 10 Dec 2010 15:37:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBAFbsQA078494; Fri, 10 Dec 2010 15:37:54 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBAFbsAC078492; Fri, 10 Dec 2010 15:37:54 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201012101537.oBAFbsAC078492@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Fri, 10 Dec 2010 15:37:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216359 - stable/8/sys/netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Dec 2010 15:37:55 -0000 Author: bz Date: Fri Dec 10 15:37:54 2010 New Revision: 216359 URL: http://svn.freebsd.org/changeset/base/216359 Log: MFC r216277: Loosen the locking in nd6-free() again after r216022 (r216118 in stable/8) to avoid a LOR and a recursed lock. Reported by: delphij Tested by: delphij PR: kern/148857 Approved by: re (kib) Modified: stable/8/sys/netinet6/nd6.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet6/nd6.c ============================================================================== --- stable/8/sys/netinet6/nd6.c Fri Dec 10 15:05:49 2010 (r216358) +++ stable/8/sys/netinet6/nd6.c Fri Dec 10 15:37:54 2010 (r216359) @@ -1049,15 +1049,6 @@ nd6_free(struct llentry *ln, int gc) return (next); } - if (ln->ln_router || dr) { - /* - * rt6_flush must be called whether or not the neighbor - * is in the Default Router List. - * See a corresponding comment in nd6_na_input(). - */ - rt6_flush(&L3_ADDR_SIN6(ln)->sin6_addr, ifp); - } - if (dr) { /* * Unreachablity of a router might affect the default @@ -1073,8 +1064,28 @@ nd6_free(struct llentry *ln, int gc) * or the entry itself will be deleted. */ ln->ln_state = ND6_LLINFO_INCOMPLETE; + } + + if (ln->ln_router || dr) { /* + * We need to unlock to avoid a LOR with rt6_flush() with the + * rnh and for the calls to pfxlist_onlink_check() and + * defrouter_select() in the block further down for calls + * into nd6_lookup(). We still hold a ref. + */ + LLE_WUNLOCK(ln); + + /* + * rt6_flush must be called whether or not the neighbor + * is in the Default Router List. + * See a corresponding comment in nd6_na_input(). + */ + rt6_flush(&L3_ADDR_SIN6(ln)->sin6_addr, ifp); + } + + if (dr) { + /* * Since defrouter_select() does not affect the * on-link determination and MIP6 needs the check * before the default router selection, we perform @@ -1083,13 +1094,13 @@ nd6_free(struct llentry *ln, int gc) pfxlist_onlink_check(); /* - * Refresh default router list. Have to unlock as - * it calls into nd6_lookup(), still holding a ref. + * Refresh default router list. */ - LLE_WUNLOCK(ln); defrouter_select(); - LLE_WLOCK(ln); } + + if (ln->ln_router || dr) + LLE_WLOCK(ln); } /*