[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1187605699.2920.147.camel@acpi-hp.sh.intel.com>
Date: Mon, 20 Aug 2007 18:28:19 +0800
From: Zhang Rui <rui.zhang@...el.com>
To: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-acpi@...r.kernel.org
Subject: [PATCH] [-mm] FS: file name must be unique in the same dir in
procfs
Files name must 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@...el.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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists