svn commit: r277189 - projects/ifnet/sys/net

Gleb Smirnoff glebius at FreeBSD.org
Wed Jan 14 19:42:37 UTC 2015


Author: glebius
Date: Wed Jan 14 19:42:36 2015
New Revision: 277189
URL: https://svnweb.freebsd.org/changeset/base/277189

Log:
  Call ift_detach from if_detach(), not from if_free().

Modified:
  projects/ifnet/sys/net/if.c

Modified: projects/ifnet/sys/net/if.c
==============================================================================
--- projects/ifnet/sys/net/if.c	Wed Jan 14 19:42:11 2015	(r277188)
+++ projects/ifnet/sys/net/if.c	Wed Jan 14 19:42:36 2015	(r277189)
@@ -638,14 +638,10 @@ if_attach(struct if_attach_args *ifat)
 static void
 if_free_internal(struct ifnet *ifp)
 {
-	struct iftype *ift = ifp->if_type;
 
 	KASSERT((ifp->if_flags & IFF_DYING),
 	    ("if_free_internal: interface not dying"));
 
-	if (ift != NULL && ift->ift_detach != NULL)
-		ift->ift_detach(ifp);
-
 #ifdef MAC
 	mac_ifnet_destroy(ifp);
 #endif /* MAC */
@@ -1012,6 +1008,11 @@ if_detach_internal(struct ifnet *ifp, in
 		devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL);
 
 	if (!vmove) {
+		struct iftype *ift = ifp->if_type;
+
+		if (ift != NULL && ift->ift_detach != NULL)
+			ift->ift_detach(ifp);
+
 		/*
 		 * Prevent further calls into the device driver via ifnet.
 		 */


More information about the svn-src-projects mailing list