From: Takashi Iwai Date: Fri, 28 Apr 2017 13:00:15 +0000 (+0200) Subject: proc: Fix unbalanced hard link numbers X-Git-Tag: C0P2-H0.0--20200415~8984 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=d10b21d6e56261f5d815b8783f944cae8c6369c1;p=linux.git proc: Fix unbalanced hard link numbers commit d66bb1607e2d8d384e53f3d93db5c18483c8c4f7 upstream. 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: eb6d38d5427b ("proc: Allow creating permanently empty directories...") Reported-by: Tristan Ye Signed-off-by: Takashi Iwai Signed-off-by: Eric W. Biederman Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 5f2dc2032c79..6047471575bb 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -471,6 +471,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--;