From eb03a443254c61f0b043c74f9671455e16919148 Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Fri, 31 Jan 2020 22:54:44 +0000 Subject: [PATCH] vlan: Fix panic when vnet jail with a vlan interface is destroyed During vnet cleanup vnet_if_uninit() checks that no more interfaces remain in the vnet. Any interface borrowed from another vnet is returned by vnet_if_return(). Other interfaces (i.e. cloned interfaces) should have been destroyed by their cloner at this point. The if_vlan VNET_SYSUNINIT had priority SI_ORDER_FIRST, which means it had equal priority as vnet_if_uninit(). In other words: it was possible for it to be called *after* vnet_if_uninit(), which would lead to assertion failures. Set the priority to SI_ORDER_ANY, like other cloners to ensure that vlan interfaces are destroyed before we enter vnet_if_uninit(). The sys/net/if_vlan test provoked this. --- sys/net/if_vlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index e9c083c1c4b5..6914a3c4a367 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -921,7 +921,7 @@ vnet_vlan_uninit(const void *unused __unused) if_clone_detach(V_vlan_cloner); } -VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_INIT_IF, SI_ORDER_FIRST, +VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, vnet_vlan_uninit, NULL); #endif