svn commit: r325283 - head/sys/net
Kristof Provost
kp at FreeBSD.org
Wed Nov 1 14:27:27 UTC 2017
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);
More information about the svn-src-head
mailing list