Skip to content

Commit ff78fca

Browse files
author
Al Viro
committed
fix leak in proc_set_super()
set_anon_super() can fail... Signed-off-by: Al Viro <[email protected]>
1 parent b99ca60 commit ff78fca

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

fs/proc/root.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ static int proc_test_super(struct super_block *sb, void *data)
2828

2929
static int proc_set_super(struct super_block *sb, void *data)
3030
{
31-
struct pid_namespace *ns;
32-
33-
ns = (struct pid_namespace *)data;
34-
sb->s_fs_info = get_pid_ns(ns);
35-
return set_anon_super(sb, NULL);
31+
int err = set_anon_super(sb, NULL);
32+
if (!err) {
33+
struct pid_namespace *ns = (struct pid_namespace *)data;
34+
sb->s_fs_info = get_pid_ns(ns);
35+
}
36+
return err;
3637
}
3738

3839
static struct dentry *proc_mount(struct file_system_type *fs_type,

0 commit comments

Comments
 (0)