diff options
| author | Gleb Smirnoff <glebius@FreeBSD.org> | 2025-12-10 19:20:14 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2025-12-10 19:20:14 +0000 |
| commit | 89eddfb4b9f5d744623ce0ee8ea966b0d33456e5 (patch) | |
| tree | b069865b3e0912f639edf3ea253bbc4321c75dba | |
| parent | 332096ebb6380ae65829018b4e1d611cd68dcc33 (diff) | |
linux: fix panic on kldunload
The vnet_deregister_sysuninit() that is called by linker unload sequence also
calls every registered destructor before unregistering it. IMHO, this is
not correct in principle, but for now plug the regression right in the code
that introduced the panic.
Fixes: 607f11055d2d421770963162a4d9a99cdd136152
| -rw-r--r-- | sys/compat/linux/linux_if.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_if.c b/sys/compat/linux/linux_if.c index 1281207c1c84..b342b07a6722 100644 --- a/sys/compat/linux/linux_if.c +++ b/sys/compat/linux/linux_if.c @@ -105,6 +105,13 @@ VNET_SYSINIT(linux_ifnet_vnet_init, SI_SUB_PROTO_IF, SI_ORDER_ANY, static void linux_ifnet_vnet_uninit(void *arg __unused) { + /* + * At a normal vnet shutdown all interfaces are gone at this point. + * But when we kldunload linux.ko, the vnet_deregister_sysuninit() + * would call this function for the default vnet. + */ + if (IS_DEFAULT_VNET(curvnet)) + clear_unrhdr(V_linux_eth_unr); delete_unrhdr(V_linux_eth_unr); } VNET_SYSUNINIT(linux_ifnet_vnet_uninit, SI_SUB_PROTO_IF, SI_ORDER_ANY, |
