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
This commit is contained in:
Kristof Provost 2017-11-01 14:27:26 +00:00
parent 62d08fae13
commit 85f330e5fa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325283

View File

@ -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);