summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2026-01-15 13:37:34 -0800
committerGleb Smirnoff <glebius@FreeBSD.org>2026-01-15 13:37:34 -0800
commitf9ae08a88924ba861ad0bb76f5a9a11fb44eced8 (patch)
tree0f5ea630667f6dd174f5c87a6245bf8f45f32120 /sys
parentce8cd5dab3b3b5fabe4a49345e20bca62c36a132 (diff)
linux: on vnet detach call clean_unrhdr(9) always
The assumption was incorrect, and the current VIMAGE implementation leaves a possibility for some interfaces still exist in a jail that is going away. Fixes: 607f11055d2d421770963162a4d9a99cdd136152
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/linux/linux_if.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/compat/linux/linux_if.c b/sys/compat/linux/linux_if.c
index f201f7c4b128..ca4e3a4079ed 100644
--- a/sys/compat/linux/linux_if.c
+++ b/sys/compat/linux/linux_if.c
@@ -105,12 +105,13 @@ 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.
+ * All cloned interfaces are already gone at this point, as well
+ * as interfaces that were if_vmove'd into this vnet. However,
+ * if a jail has created IFT_ETHER interfaces in self, or has had
+ * physical Ethernet drivers attached in self, than we may have
+ * allocated entries in the unr(9), so clear it to avoid KASSERT.
*/
- if (IS_DEFAULT_VNET(curvnet))
- clear_unrhdr(V_linux_eth_unr);
+ 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,