Skip to content

Commit ea857f2

Browse files
Dan Carpenterdavem330
authored andcommitted
ipip: dereferencing an ERR_PTR in ip_tunnel_init_net()
We need to move the derefernce after the IS_ERR() check. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0dde802 commit ea857f2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎net/ipv4/ip_tunnel.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,14 +854,14 @@ int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
854854

855855
rtnl_lock();
856856
itn->fb_tunnel_dev = __ip_tunnel_create(net, ops, &parms);
857-
/* FB netdevice is special: we have one, and only one per netns.
858-
* Allowing to move it to another netns is clearly unsafe.
859-
*/
860-
itn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
861857
rtnl_unlock();
862858

863859
if (IS_ERR(itn->fb_tunnel_dev))
864860
return PTR_ERR(itn->fb_tunnel_dev);
861+
/* FB netdevice is special: we have one, and only one per netns.
862+
* Allowing to move it to another netns is clearly unsafe.
863+
*/
864+
itn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
865865

866866
return 0;
867867
}

0 commit comments

Comments
 (0)