Hello,
I think that I have found a problem with proc_dir_entry(). It seems to
allow multiple /proc entries to be created with the same name, without
returning a NULL pointer. I asked the folks on #kernelnewbies, and they
said that perhaps this is a feature. In either case, I believe that the
following patch fixes the issue by checking if a proc entry already exists
before creating it. This mirrors the behavior of remove_proc_entry, which
checks for the presense of a proc entry before deleting it.
Thank you
- Brent
--- linux/fs/proc/generic.bak Tue Feb 5 10:51:30 2002
+++ linux/fs/proc/generic.c Tue Feb 5 11:03:24 2002
@@ -418,6 +418,7 @@
mode_t mode,
nlink_t nlink)
{
+ struct proc_dir_entry **p;
struct proc_dir_entry *ent = NULL;
const char *fn = name;
int len;
@@ -429,6 +430,12 @@
goto out;
len = strlen(fn);
+ /* check for a duplication */
+ for (p = &(*parent)->subdir; *p; p=&(*p)->next ) {
+ if (proc_match(len, fn, *p))
+ goto out;
+ }
+
ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
if (!ent) goto out;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Feb 07 2002 - 21:00:46 EST