提交 20ca9b3f 编写于 作者: L Li Zefan 提交者: Linus Torvalds

cgroups: avoid accessing uninitialized data in failure path

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 introduced this bug in the 2.6.27 merge window.
Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
Acked-by: NSerge Hallyn <serue@us.ibm.com>
Cc: Paul Menage <menage@google.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e368d3a8
...@@ -1024,7 +1024,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type, ...@@ -1024,7 +1024,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
if (ret == -EBUSY) { if (ret == -EBUSY) {
mutex_unlock(&cgroup_mutex); mutex_unlock(&cgroup_mutex);
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
goto drop_new_super; goto free_cg_links;
} }
/* EBUSY should be the only error here */ /* EBUSY should be the only error here */
...@@ -1073,10 +1073,11 @@ static int cgroup_get_sb(struct file_system_type *fs_type, ...@@ -1073,10 +1073,11 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
return simple_set_mnt(mnt, sb); return simple_set_mnt(mnt, sb);
free_cg_links:
free_cg_links(&tmp_cg_links);
drop_new_super: drop_new_super:
up_write(&sb->s_umount); up_write(&sb->s_umount);
deactivate_super(sb); deactivate_super(sb);
free_cg_links(&tmp_cg_links);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册