All of lore.kernel.org
 help / color / mirror / Atom feed
* Fix for duplicate /proc entries
@ 2002-02-06  3:52 Brent Cook
  2002-02-06 18:11 ` Dave Jones
  0 siblings, 1 reply; 23+ messages in thread
From: Brent Cook @ 2002-02-06  3:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: busterb

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;


^ permalink raw reply	[flat|nested] 23+ messages in thread
[parent not found: <Pine.LNX.4.33.0202081203020.29252-100000@coffee.psychology.mcmaster.ca>]

end of thread, other threads:[~2002-06-19 18:27 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-06  3:52 Fix for duplicate /proc entries Brent Cook
2002-02-06 18:11 ` Dave Jones
2002-02-07 21:38   ` Brent Cook
2002-02-07 21:45     ` Dave Jones
2002-02-08 16:13       ` Brent Cook
2002-02-08 17:47         ` Mike Fedyk
2002-02-08 17:54           ` Alexander Viro
2002-02-08 18:12             ` Tommy Reynolds
2002-06-14 22:30       ` File permission problem with NFSv3 and 2.5.20-dj4 Brent Cook
2002-06-15 12:23         ` Dave Jones
2002-06-19 17:45           ` Brent Cook
2002-06-19 17:48             ` Dave Jones
2002-06-19 17:52             ` another sched.c error with athlon Kirk Reiser
2002-06-19 18:27               ` Adrian Bunk
2002-04-10 14:02   ` Mouse interrupts: the death knell of a VP6 Brent Cook
2002-04-10 15:23     ` Oleg Drokin
2002-04-10 16:43       ` Brent Cook
2002-04-10 16:49         ` William Park
2002-04-11  6:39           ` john slee
2002-04-10 20:55         ` Oleg Drokin
2002-04-10 17:16       ` John Adams
2002-04-10 17:52         ` Brent Cook
     [not found] <Pine.LNX.4.33.0202081203020.29252-100000@coffee.psychology.mcmaster.ca>
2002-02-08 19:26 ` Fix for duplicate /proc entries Brent Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.