fix leak in proc_set_super()
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 12 Jun 2011 13:42:17 +0000 (09:42 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 12 Jun 2011 21:45:28 +0000 (17:45 -0400)
set_anon_super() can fail...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/proc/root.c

index a9000e9..d6c3b41 100644 (file)
@@ -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,