lvs-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Julian Anastasov <ja@ssi.bg>
Cc: Wang Hai <wanghai38@huawei.com>,
	horms@verge.net.au, kadlec@netfilter.org, fw@strlen.de,
	davem@davemloft.net, kuba@kernel.org, christian@brauner.io,
	hans.schillstrom@ericsson.com, lvs-devel@vger.kernel.org,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3] ipvs: fix possible memory leak in ip_vs_control_net_init
Date: Fri, 27 Nov 2020 12:09:41 +0100	[thread overview]
Message-ID: <20201127110941.GA11008@salvia> (raw)
In-Reply-To: <3164a9e0-962a-c54-129e-9ad780c454c8@ssi.bg>

On Tue, Nov 24, 2020 at 08:09:19PM +0200, Julian Anastasov wrote:
> 
> 	Hello,
> 
> On Tue, 24 Nov 2020, Wang Hai wrote:
> 
> > kmemleak report a memory leak as follows:
> > 
> > BUG: memory leak
> > unreferenced object 0xffff8880759ea000 (size 256):
> > backtrace:
> > [<00000000c0bf2deb>] kmem_cache_zalloc include/linux/slab.h:656 [inline]
> > [<00000000c0bf2deb>] __proc_create+0x23d/0x7d0 fs/proc/generic.c:421
> > [<000000009d718d02>] proc_create_reg+0x8e/0x140 fs/proc/generic.c:535
> > [<0000000097bbfc4f>] proc_create_net_data+0x8c/0x1b0 fs/proc/proc_net.c:126
> > [<00000000652480fc>] ip_vs_control_net_init+0x308/0x13a0 net/netfilter/ipvs/ip_vs_ctl.c:4169
> > [<000000004c927ebe>] __ip_vs_init+0x211/0x400 net/netfilter/ipvs/ip_vs_core.c:2429
> > [<00000000aa6b72d9>] ops_init+0xa8/0x3c0 net/core/net_namespace.c:151
> > [<00000000153fd114>] setup_net+0x2de/0x7e0 net/core/net_namespace.c:341
> > [<00000000be4e4f07>] copy_net_ns+0x27d/0x530 net/core/net_namespace.c:482
> > [<00000000f1c23ec9>] create_new_namespaces+0x382/0xa30 kernel/nsproxy.c:110
> > [<00000000098a5757>] copy_namespaces+0x2e6/0x3b0 kernel/nsproxy.c:179
> > [<0000000026ce39e9>] copy_process+0x220a/0x5f00 kernel/fork.c:2072
> > [<00000000b71f4efe>] _do_fork+0xc7/0xda0 kernel/fork.c:2428
> > [<000000002974ee96>] __do_sys_clone3+0x18a/0x280 kernel/fork.c:2703
> > [<0000000062ac0a4d>] do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46
> > [<0000000093f1ce2c>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
> > 
> > In the error path of ip_vs_control_net_init(), remove_proc_entry() needs
> > to be called to remove the added proc entry, otherwise a memory leak
> > will occur.
> > 
> > Also, add some '#ifdef CONFIG_PROC_FS' because proc_create_net* return NULL
> > when PROC is not used.
> > 
> > Fixes: b17fc9963f83 ("IPVS: netns, ip_vs_stats and its procfs")
> > Fixes: 61b1ab4583e2 ("IPVS: netns, add basic init per netns.")
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Wang Hai <wanghai38@huawei.com>
> 
> 	Looks good to me, thanks!
> 
> Acked-by: Julian Anastasov <ja@ssi.bg>

Applied, thanks.

      reply	other threads:[~2020-11-27 11:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24  8:07 [PATCH net v3] ipvs: fix possible memory leak in ip_vs_control_net_init Wang Hai
2020-11-24 18:09 ` Julian Anastasov
2020-11-27 11:09   ` Pablo Neira Ayuso [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201127110941.GA11008@salvia \
    --to=pablo@netfilter.org \
    --cc=christian@brauner.io \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=hans.schillstrom@ericsson.com \
    --cc=horms@verge.net.au \
    --cc=ja@ssi.bg \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=wanghai38@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).