svn commit: r300742 - projects/vnet/sys/net

Bjoern A. Zeeb bz at FreeBSD.org
Thu May 26 14:02:43 UTC 2016


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);
 }
 
 /*


More information about the svn-src-projects mailing list