vti: remove duplicated code to fix a memory leak
[ Upstream commit ab6c7a0a43 ]
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)
Signed-off-by: Cong Wang <amwang@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: Saurabh Mohan <saurabh.mohan@vyatta.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3d3fa8bca3
commit
da04e7df04
1 changed files with 0 additions and 7 deletions
|
|
@ -606,17 +606,10 @@ static int __net_init vti_fb_tunnel_init(struct net_device *dev)
|
|||
struct iphdr *iph = &tunnel->parms.iph;
|
||||
struct vti_net *ipn = net_generic(dev_net(dev), vti_net_id);
|
||||
|
||||
tunnel->dev = dev;
|
||||
strcpy(tunnel->parms.name, dev->name);
|
||||
|
||||
iph->version = 4;
|
||||
iph->protocol = IPPROTO_IPIP;
|
||||
iph->ihl = 5;
|
||||
|
||||
dev->tstats = alloc_percpu(struct pcpu_tstats);
|
||||
if (!dev->tstats)
|
||||
return -ENOMEM;
|
||||
|
||||
dev_hold(dev);
|
||||
rcu_assign_pointer(ipn->tunnels_wc[0], tunnel);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue