From: Hristo Venev Date: Mon, 12 Apr 2021 17:41:17 +0000 (+0300) Subject: net: ip6_tunnel: Unregister catch-all devices X-Git-Tag: accepted/tizen/unified/20230118.172025~7473^2~20^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=941ea91e87a6e879ed82dad4949f6234f2702bec;p=platform%2Fkernel%2Flinux-rpi.git net: ip6_tunnel: Unregister catch-all devices Similarly to the sit case, we need to remove the tunnels with no addresses that have been moved to another network namespace. Fixes: 0bd8762824e73 ("ip6tnl: add x-netns support") Signed-off-by: Hristo Venev Signed-off-by: David S. Miller --- diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 3fa0eca..42fe7db 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -2244,6 +2244,16 @@ static void __net_exit ip6_tnl_destroy_tunnels(struct net *net, struct list_head t = rtnl_dereference(t->next); } } + + t = rtnl_dereference(ip6n->tnls_wc[0]); + while (t) { + /* If dev is in the same netns, it has already + * been added to the list by the previous loop. + */ + if (!net_eq(dev_net(t->dev), net)) + unregister_netdevice_queue(t->dev, list); + t = rtnl_dereference(t->next); + } } static int __net_init ip6_tnl_init_net(struct net *net)