proc: Fix unbalanced hard link numbers

proc_create_mount_point() forgot to increase the parent's nlink, and
it resulted in unbalanced hard link numbers, e.g. /proc/fs shows one
less than expected.

Fixes: eb6d38d542 ("proc: Allow creating permanently empty directories...")
Cc: stable@vger.kernel.org
Reported-by: Tristan Ye <tristan.ye@suse.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
This commit is contained in:
Takashi Iwai 2017-04-28 15:00:15 +02:00 committed by Eric W. Biederman
parent 6c478ae920
commit d66bb1607e

View File

@ -472,6 +472,7 @@ struct proc_dir_entry *proc_create_mount_point(const char *name)
ent->data = NULL;
ent->proc_fops = NULL;
ent->proc_iops = NULL;
parent->nlink++;
if (proc_register(parent, ent) < 0) {
kfree(ent);
parent->nlink--;