From: ebiederm@xmission.com (Eric W. Biederman)
To: Gao feng <gaofeng@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, containers@lists.linux-foundation.org
Subject: Re: [PATCH] namespace:unmount pid_namespace's proc_mnt when copy_net_ns failed
Date: Fri, 02 Nov 2012 00:02:57 -0700 [thread overview]
Message-ID: <87ehkcij1a.fsf@xmission.com> (raw)
In-Reply-To: <1351816703-8805-1-git-send-email-gaofeng@cn.fujitsu.com> (Gao feng's message of "Fri, 2 Nov 2012 08:38:23 +0800")
Gao feng <gaofeng@cn.fujitsu.com> writes:
> we should call pid_ns_release_proc to unmount pid_namespace's
> proc_mnt when copy_net_ns failed in function create_new_namespaces.
>
> otherwise,the proc_mnt will not be freed and because the super_block
> of proc_mnt also add the reference of the pid_namespace,so this
> pid_namespace will never be released too.
Ouch!
Have you encountered this failure in practice or is this just from
review?
I'm trying to gauge the severity of this leak.
Eric
> Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
> ---
> kernel/nsproxy.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
> index b576f7f..d536480 100644
> --- a/kernel/nsproxy.c
> +++ b/kernel/nsproxy.c
> @@ -99,8 +99,11 @@ static struct nsproxy *create_new_namespaces(unsigned long flags,
> return new_nsp;
>
> out_net:
> - if (new_nsp->pid_ns)
> + if (new_nsp->pid_ns) {
> + if (flags & CLONE_NEWPID)
> + pid_ns_release_proc(new_nsp->pid_ns);
> put_pid_ns(new_nsp->pid_ns);
> + }
> out_pid:
> if (new_nsp->ipc_ns)
> put_ipc_ns(new_nsp->ipc_ns);
next prev parent reply other threads:[~2012-11-02 7:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-02 0:38 [PATCH] namespace:unmount pid_namespace's proc_mnt when copy_net_ns failed Gao feng
2012-11-02 7:02 ` Eric W. Biederman [this message]
2012-11-02 7:33 ` Gao feng
2012-11-02 8:54 ` Eric W. Biederman
2012-11-02 9:02 ` Gao feng
2012-11-02 9:10 ` Eric W. Biederman
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=87ehkcij1a.fsf@xmission.com \
--to=ebiederm@xmission.com \
--cc=containers@lists.linux-foundation.org \
--cc=gaofeng@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
/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