public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux Containers <containers@lists.linux-foundation.org>,
	Paul Menage <menage@google.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cgroups: avoid accessing uninitialized data in failure path
Date: Tue, 23 Dec 2008 10:28:26 -0600	[thread overview]
Message-ID: <20081223162826.GA16914@us.ibm.com> (raw)
In-Reply-To: <4950595C.9070907@cn.fujitsu.com>

Quoting Li Zefan (lizf@cn.fujitsu.com):
> If cgroup_get_rootdir() failed, free_cg_links() will be called
> in the failure path, but tmp_cg_links hasn't been initialized
> at that time.
> 
> I should be blamed to introduce this bug in 2.6.26 merge window.
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>

Certainly looks right.

Acked-by: Serge Hallyn <serue@us.ibm.com>

> ---
>  kernel/cgroup.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/cgroup.c b/kernel/cgroup.c
> index 8185a0f..330b7ae 100644
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -1024,7 +1024,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
>  		if (ret == -EBUSY) {
>  			mutex_unlock(&cgroup_mutex);
>  			mutex_unlock(&inode->i_mutex);
> -			goto drop_new_super;
> +			goto free_cg_links;
>  		}
> 
>  		/* EBUSY should be the only error here */
> @@ -1073,10 +1073,11 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
> 
>  	return simple_set_mnt(mnt, sb);
> 
> + free_cg_links:
> +	free_cg_links(&tmp_cg_links);
>   drop_new_super:
>  	up_write(&sb->s_umount);
>  	deactivate_super(sb);
> -	free_cg_links(&tmp_cg_links);
>  	return ret;
>  }
> 
> -- 
> 1.5.4.rc3
> 
> _______________________________________________
> Containers mailing list
> Containers@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/containers

      parent reply	other threads:[~2008-12-23 16:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-23  3:22 [PATCH] cgroups: avoid accessing uninitialized data in failure path Li Zefan
2008-12-23  3:25 ` Li Zefan
2008-12-23 16:28 ` Serge E. Hallyn [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=20081223162826.GA16914@us.ibm.com \
    --to=serue@us.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=menage@google.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