lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 2 Apr 2016 15:31:20 -0700
From:	Cong Wang <xiyou.wangcong@...il.com>
To:	Dmitry Vyukov <dvyukov@...gle.com>
Cc:	"David S. Miller" <davem@...emloft.net>,
	Nicolas Dichtel <nicolas.dichtel@...nd.com>,
	Thomas Graf <tgraf@...g.ch>, netdev <netdev@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Eric Dumazet <edumazet@...gle.com>,
	syzkaller <syzkaller@...glegroups.com>,
	Kostya Serebryany <kcc@...gle.com>,
	Alexander Potapenko <glider@...gle.com>,
	Sasha Levin <sasha.levin@...cle.com>
Subject: Re: net: memory leak due to CLONE_NEWNET

On Sat, Apr 2, 2016 at 6:55 AM, Dmitry Vyukov <dvyukov@...gle.com> wrote:
> Hello,
>
> The following program leads to memory leaks in:
>
> unreferenced object 0xffff88005c10d208 (size 96):
>   comm "a.out", pid 10753, jiffies 4296778619 (age 43.118s)
>   hex dump (first 32 bytes):
>     e8 31 85 2d 00 88 ff ff 0f 00 00 00 00 00 00 00  .1.-............
>     00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00  .....N..........
>   backtrace:
>     [<ffffffff8679bb23>] kmemleak_alloc+0x63/0xa0 mm/kmemleak.c:915
>     [<     inline     >] kmemleak_alloc_recursive include/linux/kmemleak.h:47
>     [<     inline     >] slab_post_alloc_hook mm/slab.h:406
>     [<     inline     >] slab_alloc_node mm/slub.c:2602
>     [<     inline     >] slab_alloc mm/slub.c:2610
>     [<ffffffff8179b4c0>] kmem_cache_alloc_trace+0x160/0x3d0 mm/slub.c:2627
>     [<     inline     >] kmalloc include/linux/slab.h:478
>     [<     inline     >] tc_action_net_init include/net/act_api.h:122
>     [<ffffffff8574e62e>] csum_init_net+0x15e/0x450 net/sched/act_csum.c:593
>     [<ffffffff8564ffc9>] ops_init+0xa9/0x3a0 net/core/net_namespace.c:109
>     [<ffffffff85650474>] setup_net+0x1b4/0x3e0 net/core/net_namespace.c:287
>     [<ffffffff85651a56>] copy_net_ns+0xd6/0x1a0 net/core/net_namespace.c:367
>     [<ffffffff813d01bf>] create_new_namespaces+0x37f/0x740 kernel/nsproxy.c:106
>     [<ffffffff813d0b69>] unshare_nsproxy_namespaces+0xa9/0x1d0

The following patch should fix it.

diff --git a/include/net/act_api.h b/include/net/act_api.h
index 2a19fe1..03e322b 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -135,6 +135,7 @@ void tcf_hashinfo_destroy(const struct tc_action_ops *ops,
 static inline void tc_action_net_exit(struct tc_action_net *tn)
 {
        tcf_hashinfo_destroy(tn->ops, tn->hinfo);
+       kfree(tn->hinfo);
 }

 int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ