Commit 3a9700b0 authored by Takashi Iwai's avatar Takashi Iwai Committed by Sasha Levin

proc: Fix unbalanced hard link numbers

[ Upstream commit d66bb160 ]

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: eb6d38d5 ("proc: Allow creating permanently empty directories...")
Cc: stable@vger.kernel.org
Reported-by: default avatarTristan Ye <tristan.ye@suse.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 2279c8b9
...@@ -469,6 +469,7 @@ struct proc_dir_entry *proc_create_mount_point(const char *name) ...@@ -469,6 +469,7 @@ struct proc_dir_entry *proc_create_mount_point(const char *name)
ent->data = NULL; ent->data = NULL;
ent->proc_fops = NULL; ent->proc_fops = NULL;
ent->proc_iops = NULL; ent->proc_iops = NULL;
parent->nlink++;
if (proc_register(parent, ent) < 0) { if (proc_register(parent, ent) < 0) {
kfree(ent); kfree(ent);
parent->nlink--; parent->nlink--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment