]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.30/proc-fix-unbalanced-hard-link-numbers.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 4.9.30 / proc-fix-unbalanced-hard-link-numbers.patch
CommitLineData
899c9bca
GKH
1From d66bb1607e2d8d384e53f3d93db5c18483c8c4f7 Mon Sep 17 00:00:00 2001
2From: Takashi Iwai <tiwai@suse.de>
3Date: Fri, 28 Apr 2017 15:00:15 +0200
4Subject: proc: Fix unbalanced hard link numbers
5
6From: Takashi Iwai <tiwai@suse.de>
7
8commit d66bb1607e2d8d384e53f3d93db5c18483c8c4f7 upstream.
9
10proc_create_mount_point() forgot to increase the parent's nlink, and
11it resulted in unbalanced hard link numbers, e.g. /proc/fs shows one
12less than expected.
13
14Fixes: eb6d38d5427b ("proc: Allow creating permanently empty directories...")
15Reported-by: Tristan Ye <tristan.ye@suse.com>
16Signed-off-by: Takashi Iwai <tiwai@suse.de>
17Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
18Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20---
21 fs/proc/generic.c | 1 +
22 1 file changed, 1 insertion(+)
23
24--- a/fs/proc/generic.c
25+++ b/fs/proc/generic.c
26@@ -471,6 +471,7 @@ struct proc_dir_entry *proc_create_mount
27 ent->data = NULL;
28 ent->proc_fops = NULL;
29 ent->proc_iops = NULL;
30+ parent->nlink++;
31 if (proc_register(parent, ent) < 0) {
32 kfree(ent);
33 parent->nlink--;