summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuniyuki Iwashima <kuniyu@google.com>2026-09-12 23:00:30 +0000
committerPaolo Abeni <pabeni@redhat.com>2026-09-15 13:21:32 +0200
commite53013fe10c22fc4e2cc1b45180790a5429c7aa9 (patch)
treecd3d4ef3fac219967081d5137f59f0af93f391c8
parent7ba090b04ab87b90e714e5fb3ba8748f6f04d2a0 (diff)
downloadlinux-next-e53013fe10c22fc4e2cc1b45180790a5429c7aa9.tar.gz
linux-next-e53013fe10c22fc4e2cc1b45180790a5429c7aa9.zip
ip_tunnel: Centralise ip_tunnel_del() to ip_tunnel_dellink().
With the previous patch, itn->fb_tunnel_dev can be removed via ->dellink(). However, ioctl(SIOCDELTUNNEL) still uses unregister_netdevice(), which requires ip_tunnel_del() in ip_tunnel_uninit(). Let's use ip_tunnel_dellink() everywhere to remove ip_tunnel device and remove ip_tunnel_del() in ip_tunnel_uninit(). Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260912230043.2586313-5-kuniyu@google.com Reviewed-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r--net/ipv4/ip_tunnel.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index e6bbc5e4c357..7d7baaa57741 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -895,10 +895,13 @@ static void ip_tunnel_update(struct ip_tunnel_net *itn,
int ip_tunnel_ctl(struct net_device *dev, struct ip_tunnel_parm_kern *p,
int cmd)
{
- int err = 0;
struct ip_tunnel *t = netdev_priv(dev);
+ struct ip_tunnel_net *itn;
+ LIST_HEAD(dev_kill_list);
struct net *net = t->net;
- struct ip_tunnel_net *itn = net_generic(net, t->ip_tnl_net_id);
+ int err = 0;
+
+ itn = net_generic(net, t->ip_tnl_net_id);
switch (cmd) {
case SIOCGETTUNNEL:
@@ -982,7 +985,8 @@ int ip_tunnel_ctl(struct net_device *dev, struct ip_tunnel_parm_kern *p,
goto done;
dev = t->dev;
}
- unregister_netdevice(dev);
+
+ ip_tunnel_dellink(dev, &dev_kill_list);
err = 0;
break;
@@ -991,6 +995,8 @@ int ip_tunnel_ctl(struct net_device *dev, struct ip_tunnel_parm_kern *p,
}
done:
+ unregister_netdevice_many(&dev_kill_list);
+
return err;
}
EXPORT_SYMBOL_GPL(ip_tunnel_ctl);
@@ -1164,7 +1170,7 @@ void ip_tunnel_delete_net(struct net *net, unsigned int id,
struct ip_tunnel *t;
hlist_for_each_entry_safe(t, n, thead, hash_node)
- unregister_netdevice_queue(t->dev, head);
+ ip_tunnel_dellink(t->dev, head);
}
}
EXPORT_SYMBOL_GPL(ip_tunnel_delete_net);
@@ -1295,11 +1301,6 @@ EXPORT_SYMBOL_GPL(__ip_tunnel_init);
void ip_tunnel_uninit(struct net_device *dev)
{
struct ip_tunnel *tunnel = netdev_priv(dev);
- struct net *net = tunnel->net;
- struct ip_tunnel_net *itn;
-
- itn = net_generic(net, tunnel->ip_tnl_net_id);
- ip_tunnel_del(itn, netdev_priv(dev));
dst_cache_reset(&tunnel->dst_cache);
}