Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 May 2016 14:02:41 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r300742 - projects/vnet/sys/net
Message-ID:  <201605261402.u4QE2f55066173@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605261402.u4QE2f55066173>