public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Eric H. Weigle" <ehw@lanl.gov>
To: linux-kernel@vger.kernel.org
Subject: [BUG][PATCH] /proc duplicate entries
Date: Wed, 20 Jun 2001 10:09:33 -0600	[thread overview]
Message-ID: <20010620100933.B1457@lanl.gov> (raw)

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/
--------------------------------------------

                 reply	other threads:[~2001-06-20 16:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010620100933.B1457@lanl.gov \
    --to=ehw@lanl.gov \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox