]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
proc: Fix unbalanced hard link numbers
authorTakashi Iwai <tiwai@suse.de>
Fri, 28 Apr 2017 13:00:15 +0000 (15:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 May 2017 12:30:10 +0000 (14:30 +0200)
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 <tristan.ye@suse.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/proc/generic.c

index ff3ffc76a93795b6662cb80d85f2a404d8f20693..3773335791da35ae4faedfb5afeb1a9274908b3e 100644 (file)
@@ -469,6 +469,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--;