summaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-06-12 09:42:17 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-06-12 17:45:28 -0400
commitff78fca2a03c08436535d3f7152a30752d8131d1 (patch)
tree314de976604243449825241d814fb80b9a1e89b4 /fs/proc
parentb99ca60c83a631adaba9c2fff8f2dd14d3517a61 (diff)
downloadlinux-stable-ff78fca2a03c08436535d3f7152a30752d8131d1.tar.gz
linux-stable-ff78fca2a03c08436535d3f7152a30752d8131d1.tar.bz2
linux-stable-ff78fca2a03c08436535d3f7152a30752d8131d1.zip
fix leak in proc_set_super()
set_anon_super() can fail... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/root.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/proc/root.c b/fs/proc/root.c
index a9000e9cfee5..d6c3b416529b 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -28,11 +28,12 @@ static int proc_test_super(struct super_block *sb, void *data)
static int proc_set_super(struct super_block *sb, void *data)
{
- struct pid_namespace *ns;
-
- ns = (struct pid_namespace *)data;
- sb->s_fs_info = get_pid_ns(ns);
- return set_anon_super(sb, NULL);
+ int err = set_anon_super(sb, NULL);
+ if (!err) {
+ struct pid_namespace *ns = (struct pid_namespace *)data;
+ sb->s_fs_info = get_pid_ns(ns);
+ }
+ return err;
}
static struct dentry *proc_mount(struct file_system_type *fs_type,