mirror of
https://github.com/torvalds/linux.git
synced 2026-11-10 17:11:02 +01:00
ip6_gre: Initialise ign->tunnels_wc[0] before register_netdev().
ip6gre_init_net() links the fallback device ip6gre0 to ign->tunnels_wc[0] after publishing it by register_netdev(). While ip6_gre module is being loaded, there is a small race window. If ioctl(SIOCADDTUNNEL) is called before ip6gre0 is linked to the hash table, a new device could be linked to ign->tunnels_wc[0]. Then, the fallback device overwrites ign->tunnels_wc[0], and the new device will be no longer found by ip6gre_tunnel_lookup(), resulting in no RX. Let's link the fallback device before register_netdev(). Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260916230353.367014-2-kuniyu@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
5249efe2f5
commit
3e6af2e485
|
|
@ -1607,12 +1607,13 @@ static int __net_init ip6gre_init_net(struct net *net)
|
|||
ip6gre_fb_tunnel_init(ign->fb_tunnel_dev);
|
||||
ign->fb_tunnel_dev->rtnl_link_ops = &ip6gre_link_ops;
|
||||
|
||||
rcu_assign_pointer(ign->tunnels_wc[0],
|
||||
netdev_priv(ign->fb_tunnel_dev));
|
||||
|
||||
err = register_netdev(ign->fb_tunnel_dev);
|
||||
if (err)
|
||||
goto err_reg_dev;
|
||||
|
||||
rcu_assign_pointer(ign->tunnels_wc[0],
|
||||
netdev_priv(ign->fb_tunnel_dev));
|
||||
return 0;
|
||||
|
||||
err_reg_dev:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user