* [PATCH] FS: file name should be unique in the same dir in procfs
@ 2007-08-16 10:32 Zhang Rui
0 siblings, 0 replies; only message in thread
From: Zhang Rui @ 2007-08-16 10:32 UTC (permalink / raw)
To: linux-fsdevel, linux-acpi; +Cc: lenb
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 <rui.zhang@intel.com>
---
fs/proc/generic.c | 8 ++++++++
1 file changed, 8 insertions(+)
Index: linux-2.6.23-rc3/fs/proc/generic.c
===================================================================
--- linux-2.6.23-rc3.orig/fs/proc/generic.c
+++ linux-2.6.23-rc3/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,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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-08-16 10:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-16 10:32 [PATCH] FS: file name should be unique in the same dir in procfs Zhang Rui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).