ipip: dereferencing an ERR_PTR in ip_tunnel_init_net()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 19 Aug 2013 07:05:10 +0000 (10:05 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Aug 2013 22:12:15 +0000 (15:12 -0700)
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>
net/ipv4/ip_tunnel.c

index a4d9126c7b514a7f8e1dead0335023a4afc8e8b5..24549b4aeae219f19e433f31e032f795bd249166 100644 (file)
@@ -854,14 +854,14 @@ int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
 
        rtnl_lock();
        itn->fb_tunnel_dev = __ip_tunnel_create(net, ops, &parms);
-       /* 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;
        rtnl_unlock();
 
        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;
 
        return 0;
 }