From owner-svn-src-projects@freebsd.org Thu May 26 14:02:42 2016 Return-Path: Delivered-To: svn-src-projects@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 F2BEBB4B656 for ; Thu, 26 May 2016 14:02:42 +0000 (UTC) (envelope-from bz@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 C11421BE4; Thu, 26 May 2016 14:02:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4QE2f4q066174; Thu, 26 May 2016 14:02:41 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4QE2f55066173; Thu, 26 May 2016 14:02:41 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201605261402.u4QE2f55066173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 26 May 2016 14:02:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r300742 - projects/vnet/sys/net X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2016 14:02:43 -0000 Author: bz Date: Thu May 26 14:02:41 2016 New Revision: 300742 URL: https://svnweb.freebsd.org/changeset/base/300742 Log: Revert the movement of if_afdata_initialized to after we do the actual work and keep it before under the same lock. The possible race condition exists one way or antoher due to unlocking but in if_detach_internal() we do check for if_afdata[] to not be NULL before trying to free, so not extra harm is done. Sponsored by: The FreeBSD Foundation Modified: projects/vnet/sys/net/if.c Modified: projects/vnet/sys/net/if.c ============================================================================== --- projects/vnet/sys/net/if.c Thu May 26 13:49:40 2016 (r300741) +++ projects/vnet/sys/net/if.c Thu May 26 14:02:41 2016 (r300742) @@ -828,6 +828,7 @@ if_attachdomain1(struct ifnet *ifp) __func__, ifp->if_xname); return; } + ifp->if_afdata_initialized = domain_init_status; IF_AFDATA_UNLOCK(ifp); /* address family dependent data region */ @@ -837,10 +838,6 @@ if_attachdomain1(struct ifnet *ifp) ifp->if_afdata[dp->dom_family] = (*dp->dom_ifattach)(ifp); } - - IF_AFDATA_LOCK(ifp); - ifp->if_afdata_initialized = domain_init_status; - IF_AFDATA_UNLOCK(ifp); } /*