Skip to content

Commit

Permalink
procfs: fix a vfsmount longterm reference leak
Browse files Browse the repository at this point in the history
kern_mount() doesn't pair with plain mntput()...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Dec 9, 2011
1 parent 09d9673 commit 905ad26
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions fs/proc/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,18 @@ static struct file_system_type proc_fs_type = {

void __init proc_root_init(void)
{
struct vfsmount *mnt;
int err;

proc_init_inodecache();
err = register_filesystem(&proc_fs_type);
if (err)
return;
mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
if (IS_ERR(mnt)) {
err = pid_ns_prepare_proc(&init_pid_ns);
if (err) {
unregister_filesystem(&proc_fs_type);
return;
}

init_pid_ns.proc_mnt = mnt;
proc_symlink("mounts", NULL, "self/mounts");

proc_net_init();
Expand Down Expand Up @@ -209,5 +207,5 @@ int pid_ns_prepare_proc(struct pid_namespace *ns)

void pid_ns_release_proc(struct pid_namespace *ns)
{
mntput(ns->proc_mnt);
kern_unmount(ns->proc_mnt);
}

0 comments on commit 905ad26

Please sign in to comment.