Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Nov 2017 14:27:26 +0000 (UTC)
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325283 - head/sys/net
Message-ID:  <201711011427.vA1ERQTp050050@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kp
Date: Wed Nov  1 14:27:26 2017
New Revision: 325283
URL: https://svnweb.freebsd.org/changeset/base/325283

Log:
  epair: Fix panic on unload
  
  The VNET_SYSUNINIT() callback is executed after the MOD_UNLOAD. That means
  that netisr_unregister() has already been called when
  netisr_unregister_vnet() gets calls, leading to an assertion failure.
  
  Restore the expected order of operations by performing everything that
  was done in MOD_UNLOAD to a SYSUNINIT() (that will be called after the
  VNET_SYSUNINIT()).
  
  Differential Revision:	https://reviews.freebsd.org/D12771

Modified:
  head/sys/net/if_epair.c

Modified: head/sys/net/if_epair.c
==============================================================================
--- head/sys/net/if_epair.c	Wed Nov  1 13:54:16 2017	(r325282)
+++ head/sys/net/if_epair.c	Wed Nov  1 14:27:26 2017	(r325283)
@@ -980,6 +980,17 @@ vnet_epair_uninit(const void *unused __unused)
 VNET_SYSUNINIT(vnet_epair_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY,
     vnet_epair_uninit, NULL);
 
+static void
+epair_uninit(const void *unused __unused)
+{
+	netisr_unregister(&epair_nh);
+	epair_dpcpu_detach();
+	if (bootverbose)
+		printf("%s unloaded.\n", epairname);
+}
+SYSUNINIT(epair_uninit, SI_SUB_INIT_IF, SI_ORDER_MIDDLE,
+    epair_uninit, NULL);
+
 static int
 epair_modevent(module_t mod, int type, void *data)
 {
@@ -997,10 +1008,7 @@ epair_modevent(module_t mod, int type, void *data)
 			printf("%s initialized.\n", epairname);
 		break;
 	case MOD_UNLOAD:
-		netisr_unregister(&epair_nh);
-		epair_dpcpu_detach();
-		if (bootverbose)
-			printf("%s unloaded.\n", epairname);
+		/* Handled in epair_uninit() */
 		break;
 	default:
 		return (EOPNOTSUPP);



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