Commit b4de77ad authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller
Browse files

ipip: potential race in ip_tunnel_init_net()

Eric Dumazet says that my previous fix for an ERR_PTR dereference

 'ipip: dereferencing an ERR_PTR in ip_tunnel_init_net()')
could be racy and suggests the following fix instead.

Reported-by: default avatarEric Dumazet <>
Signed-off-by: default avatarDan Carpenter <>
Signed-off-by: default avatarDavid S. Miller <>
parent b8e2fde4
......@@ -854,16 +854,14 @@ int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
itn->fb_tunnel_dev = __ip_tunnel_create(net, ops, &parms);
if (IS_ERR(itn->fb_tunnel_dev))
return PTR_ERR(itn->fb_tunnel_dev);
/* FB netdevice is special: we have one, and only one per netns.
* Allowing to move it to another netns is clearly unsafe.
itn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
if (!IS_ERR(itn->fb_tunnel_dev))
itn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
return 0;
return PTR_RET(itn->fb_tunnel_dev);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment