netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] sit: fix panic with route cache in ip tunnels
@ 2014-02-19 16:15 Nicolas Dichtel
  2014-02-19 16:22 ` Nicolas Dichtel
  2014-02-19 16:43 ` [PATCH net] " Eric Dumazet
  0 siblings, 2 replies; 7+ messages in thread
From: Nicolas Dichtel @ 2014-02-19 16:15 UTC (permalink / raw)
  To: davem; +Cc: netdev, Nicolas Dichtel, Tom Herbert

Bug introduced by commit 7d442fab0a67 ("ipv4: Cache dst in tunnels").

Because sit code does not call ip_tunnel_init(), the dst_cache was not
initialized.

CC: Tom Herbert <therbert@google.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/ipv6/sit.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 3dfbcf1dcb1c..5ff33d9bd5de 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1326,6 +1326,9 @@ static const struct net_device_ops ipip6_netdev_ops = {
 
 static void ipip6_dev_free(struct net_device *dev)
 {
+	struct ip_tunnel *tunnel = netdev_priv(dev);
+
+	free_percpu(tunnel->dst_cache);
 	free_percpu(dev->tstats);
 	free_netdev(dev);
 }
@@ -1375,6 +1378,12 @@ static int ipip6_tunnel_init(struct net_device *dev)
 		u64_stats_init(&ipip6_tunnel_stats->syncp);
 	}
 
+	tunnel->dst_cache = alloc_percpu(struct ip_tunnel_dst);
+	if (!tunnel->dst_cache) {
+		free_percpu(dev->tstats);
+		return -ENOMEM;
+	}
+
 	return 0;
 }
 
-- 
1.8.5.4

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

end of thread, other threads:[~2014-02-20 18:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-19 16:15 [PATCH net] sit: fix panic with route cache in ip tunnels Nicolas Dichtel
2014-02-19 16:22 ` Nicolas Dichtel
2014-02-20  9:19   ` [PATCH net v2] " Nicolas Dichtel
2014-02-20 18:14     ` David Miller
2014-02-19 16:43 ` [PATCH net] " Eric Dumazet
2014-02-19 16:50   ` Nicolas Dichtel
2014-02-19 17:10     ` Eric Dumazet

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).