All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gao feng <gaofeng@cn.fujitsu.com>
To: "Eric W. Biederman" <raphael.scarv@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	Serge Hallyn <serge.hallyn@canonical.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] kernel/pid_namespace.c: Fixing a lack of cleanup (Probable resources leak).
Date: Tue, 05 Mar 2013 11:51:52 +0800	[thread overview]
Message-ID: <51356BD8.4040408@cn.fujitsu.com> (raw)
In-Reply-To: <1362454007-353-1-git-send-email-ebiederm@xmission.com>

On 2013/03/05 11:26, Eric W. Biederman wrote:
> From: Raphael S.Carvalho <raphael.scarv@gmail.com>
> 
> Starting point: create_pid_namespace()
> 
> Suppose create_pid_cachep() was executed sucessfully, thus:
> pcache was allocated by kmalloc().
> cachep received a cache created by kmem_cache_create().
> and pcache->list was added to the list pid_caches_lh.
> 
> So what would happen if proc_alloc_inum() returns an error?
> The resources allocated by create_pid_namespace() would be deallocated!
> How about those resources allocated by create_pid_cachep()?
> By knowing that, I created this patch in order to fix that!
> 
> Signed-off-by: Raphael S.Carvalho <raphael.scarv@gmail.com>
> ---

Actually I noticed this problem and I think it is not a BUG.
Since the pid_cache is created for all pid namespace which have the same level.
Even this pid namespace is failed to create, the pid_cache will not be leaked, Other
pid namespace which has the same level will use the pid_cache and no need to
allocate it again. In other words, the pid_cache for every level pid namespace will
only be created once.

I also think this patch add a bug,because there may be other pid namespace's pid_cachep
points to the same pid_cache which will be free at the by label out_free_cachep.


  reply	other threads:[~2013-03-05  3:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-05  3:26 [PATCH 1/1] kernel/pid_namespace.c: Fixing a lack of cleanup (Probable resources leak) Eric W. Biederman
2013-03-05  3:51 ` Gao feng [this message]
2013-03-05  5:04   ` Raphael S Carvalho
2013-03-05  5:51     ` Cyrill Gorcunov
  -- strict thread matches above, loose matches on Subject: below --
2013-03-05  3:28 Raphael S.Carvalho
2013-03-05  6:32 ` 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=51356BD8.4040408@cn.fujitsu.com \
    --to=gaofeng@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=gorcunov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=raphael.scarv@gmail.com \
    --cc=serge.hallyn@canonical.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.