Skip to content

Commit 905ad26

Browse files
author
Al Viro
committed
procfs: fix a vfsmount longterm reference leak
kern_mount() doesn't pair with plain mntput()... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 09d9673 commit 905ad26

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎fs/proc/root.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,18 @@ static struct file_system_type proc_fs_type = {
9191

9292
void __init proc_root_init(void)
9393
{
94-
struct vfsmount *mnt;
9594
int err;
9695

9796
proc_init_inodecache();
9897
err = register_filesystem(&proc_fs_type);
9998
if (err)
10099
return;
101-
mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
102-
if (IS_ERR(mnt)) {
100+
err = pid_ns_prepare_proc(&init_pid_ns);
101+
if (err) {
103102
unregister_filesystem(&proc_fs_type);
104103
return;
105104
}
106105

107-
init_pid_ns.proc_mnt = mnt;
108106
proc_symlink("mounts", NULL, "self/mounts");
109107

110108
proc_net_init();
@@ -209,5 +207,5 @@ int pid_ns_prepare_proc(struct pid_namespace *ns)
209207

210208
void pid_ns_release_proc(struct pid_namespace *ns)
211209
{
212-
mntput(ns->proc_mnt);
210+
kern_unmount(ns->proc_mnt);
213211
}

0 commit comments

Comments
 (0)