aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_vti.c
diff options
context:
space:
mode:
authorCong Wang <amwang@redhat.com>2013-06-29 01:00:57 -0400
committerDavid S. Miller <davem@davemloft.net>2013-07-02 02:37:14 -0400
commitab6c7a0a43c2eaafa57583822b619b22637b49c7 (patch)
tree8ff6f88e0601340b72518c870b317dcc25ea1f23 /net/ipv4/ip_vti.c
parent6c734fb8592f6768170e48e7102cb2f0a1bb9759 (diff)
vti: remove duplicated code to fix a memory leak
vti module allocates dev->tstats twice: in vti_fb_tunnel_init() and in vti_tunnel_init(), this lead to a memory leak of dev->tstats. Just remove the duplicated operations in vti_fb_tunnel_init(). (candidate for -stable) Cc: Stephen Hemminger <stephen@networkplumber.org> Cc: Saurabh Mohan <saurabh.mohan@vyatta.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Cong Wang <amwang@redhat.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_vti.c')
-rw-r--r--net/ipv4/ip_vti.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
index c118f6b576bb..17cc0ffa8c0d 100644
--- a/net/ipv4/ip_vti.c
+++ b/net/ipv4/ip_vti.c
@@ -606,17 +606,10 @@ static int __net_init vti_fb_tunnel_init(struct net_device *dev)
606 struct iphdr *iph = &tunnel->parms.iph; 606 struct iphdr *iph = &tunnel->parms.iph;
607 struct vti_net *ipn = net_generic(dev_net(dev), vti_net_id); 607 struct vti_net *ipn = net_generic(dev_net(dev), vti_net_id);
608 608
609 tunnel->dev = dev;
610 strcpy(tunnel->parms.name, dev->name);
611
612 iph->version = 4; 609 iph->version = 4;
613 iph->protocol = IPPROTO_IPIP; 610 iph->protocol = IPPROTO_IPIP;
614 iph->ihl = 5; 611 iph->ihl = 5;
615 612
616 dev->tstats = alloc_percpu(struct pcpu_tstats);
617 if (!dev->tstats)
618 return -ENOMEM;
619
620 dev_hold(dev); 613 dev_hold(dev);
621 rcu_assign_pointer(ipn->tunnels_wc[0], tunnel); 614 rcu_assign_pointer(ipn->tunnels_wc[0], tunnel);
622 return 0; 615 return 0;