Skip to contentSkip to conversation

proc: Fix unbalanced hard link numbers

PATCH Applied Takashi Iwai 2 participants 2 messages Apr 28, 2017 – Apr 29, 2017 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proc: Fix unbalanced hard link numbers

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...")
---
 fs/proc/generic.c | 1 +
 1 file changed, 1 insertion(+)
fs/proc/generic.c +1 -0
index ee27feb34cf4..9425c0d97262 100644
@@ -472,6 +472,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--;
Signature · 1 line
2.12.2
#1 lore raw
Quoted 3 lines · Takashi Iwai

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.

Applied. Thanks.

Quoted 21 lines
Fixes eb6d38d5427b ("proc: Allow creating permanently empty directories...")
---
 fs/proc/generic.c | 1 +
 1 file changed, 1 insertion(+)
fs/proc/generic.c +1 -0
index ee27feb34cf4..9425c0d97262 100644
@@ -472,6 +472,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--;