Skip to contentSkip to conversation

/proc duplicate entries

PATCH New Eric H. Weigle 1 participant 1 message Jun 20, 2001

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 /proc duplicate entries

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.

--------------------------------------------------------------------------------

proc/generic.c renamed from proc/generic.c.orig +8 -1
@@ -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

Signature · 5 lines
--------------------------------------------
 Eric H. Weigle   CCS-1, RADIANT team
 [email protected]     Los Alamos National Lab
 (505) 665-4937   http://home.lanl.gov/ehw/
--------------------------------------------