From: Zhang Rui In order to keep the back-compatibility, only a warning is given currently, but actions must be taken to fix it when such duplicates are detected. Bug report and a simple fix can be found here: http://bugzilla.kernel.org/show_bug.cgi?id=8798 Signed-off-by: Zhang Rui Signed-off-by: Andrew Morton --- fs/proc/generic.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff -puN fs/proc/generic.c~procfs-detect-duplicate-names fs/proc/generic.c --- a/fs/proc/generic.c~procfs-detect-duplicate-names +++ a/fs/proc/generic.c @@ -523,6 +523,7 @@ static const struct inode_operations pro static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp) { + struct proc_dir_entry *tmp = NULL; unsigned int i; i = get_inode_number(); @@ -547,11 +548,22 @@ static int proc_register(struct proc_dir } spin_lock(&proc_subdir_lock); + + for (tmp = dir->subdir, i = 0; tmp && !i; tmp = tmp->next) + if (!strcmp(dp->name, tmp->name)) + i = 1; + dp->next = dir->subdir; dp->parent = dir; dir->subdir = dp; spin_unlock(&proc_subdir_lock); + if (i) { + printk(KERN_WARNING + "Duplicate file names \"%s\" detected.", dp->name); + dump_stack(); + } + return 0; } _