Skip to content

Commit

Permalink
fix leak in proc_set_super()
Browse files Browse the repository at this point in the history
set_anon_super() can fail...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jun 12, 2011
1 parent b99ca60 commit ff78fca
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions fs/proc/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ff78fca

Please sign in to comment.