]>
Commit | Line | Data |
---|---|---|
899c9bca GKH |
1 | From d66bb1607e2d8d384e53f3d93db5c18483c8c4f7 Mon Sep 17 00:00:00 2001 |
2 | From: Takashi Iwai <tiwai@suse.de> | |
3 | Date: Fri, 28 Apr 2017 15:00:15 +0200 | |
4 | Subject: proc: Fix unbalanced hard link numbers | |
5 | ||
6 | From: Takashi Iwai <tiwai@suse.de> | |
7 | ||
8 | commit d66bb1607e2d8d384e53f3d93db5c18483c8c4f7 upstream. | |
9 | ||
10 | proc_create_mount_point() forgot to increase the parent's nlink, and | |
11 | it resulted in unbalanced hard link numbers, e.g. /proc/fs shows one | |
12 | less than expected. | |
13 | ||
14 | Fixes: eb6d38d5427b ("proc: Allow creating permanently empty directories...") | |
15 | Reported-by: Tristan Ye <tristan.ye@suse.com> | |
16 | Signed-off-by: Takashi Iwai <tiwai@suse.de> | |
17 | Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> | |
18 | Signed-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--; |