netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch -next] ipip: dereferencing an ERR_PTR in ip_tunnel_init_net()
@ 2013-08-19  7:05 Dan Carpenter
  2013-08-19  7:33 ` Nicolas Dichtel
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Dan Carpenter @ 2013-08-19  7:05 UTC (permalink / raw)
  To: David S. Miller, Nicolas Dichtel
  Cc: Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy, netdev, kernel-janitors

We need to move the derefernce after the IS_ERR() check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index a4d9126..24549b4 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -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;
 }

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-08-25 22:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-19  7:05 [patch -next] ipip: dereferencing an ERR_PTR in ip_tunnel_init_net() Dan Carpenter
2013-08-19  7:33 ` Nicolas Dichtel
2013-08-19 12:58 ` Eric Dumazet
2013-08-19 13:49   ` Dan Carpenter
2013-08-19 22:23   ` [patch -next v2] " Dan Carpenter
2013-08-21  6:33     ` David Miller
2013-08-23  8:15       ` [patch -next] ipip: potential race " Dan Carpenter
2013-08-25 22:40         ` David Miller
2013-08-20 22:08 ` [patch -next] ipip: dereferencing an ERR_PTR " David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).