public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [BUG][PATCH] /proc duplicate entries
@ 2001-06-20 16:09 Eric H. Weigle
  0 siblings, 0 replies; only message in thread
From: Eric H. Weigle @ 2001-06-20 16:09 UTC (permalink / raw)
  To: linux-kernel

Hello-

Hopefully this isn't redundant, I haven't checked the latest -ac or -pre
releases. I just noticed on my 2.4.5 box that I have two /proc/dri/ directory
entries (I've got both on-board and AGP video in the box and both are trying
to register entries).

Yes, code that tries to register the same name twice is broken, but the
filesystem still shouldn't allow bad code to break its semantics (duplicate
entries of the same name).

The following patch performs a duplicate name check.

--------------------------------------------------------------------------------
--- fs/proc/generic.c.orig	Tue Jun 19 15:44:05 2001
+++ fs/proc/generic.c	Wed Jun 20 10:02:32 2001
@@ -421,6 +421,14 @@
 		goto out;
 	len = strlen(fn);
 
+	/* check for name conflicts */
+	for (ent=(*parent)->subdir; ent; ent=ent->next) {
+		if (proc_match(len,name,ent)) {
+			ent = NULL;
+			goto out;
+		}
+	}
+
 	ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
 	if (!ent) goto out;
--------------------------------------------------------------------------------

Thanks
-Eric

-- 
--------------------------------------------
 Eric H. Weigle   CCS-1, RADIANT team
 ehw@lanl.gov     Los Alamos National Lab
 (505) 665-4937   http://home.lanl.gov/ehw/
--------------------------------------------

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-06-20 16:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-20 16:09 [BUG][PATCH] /proc duplicate entries Eric H. Weigle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox