FS: file name should be unique in the same dir in procfs
Subsystems (3)
PATCH 1/1 FS: file name should be unique in the same dir in procfs
Files name should be unique in the same directory.
Bug is reported here:
http://bugzilla.kernel.org/show_bug.cgi?id=8798
Signed-off-by Zhang Rui <[email protected]>
--- fs/proc/generic.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/proc/generic.c +8 -0
@@ -523,6 +523,7 @@ static const struct inode_operations prostatic 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,6 +548,13 @@ static int proc_register(struct proc_dir }spin_lock (&proc_subdir_lock); +for (tmp = dir->subdir; tmp; tmp = tmp->next) +if (!strcmp (dp->name, tmp->name)) { +spin_unlock (&proc_subdir_lock); +release_inode_number (i); +return -EEXIST ; + } + dp->next = dir->subdir; dp->parent = dir; dir->subdir = dp;