Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jan 2015 19:42:37 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r277189 - projects/ifnet/sys/net
Message-ID:  <201501141942.t0EJgbOg072392@svn.freebsd.org>

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



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