public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [SYSFS] Kernel Null pointer dereference in sysfs_readdir()
@ 2006-07-12 11:35 Duetsch, Thomas  LDE1
  2006-07-12 12:06 ` Steven Rostedt
  2006-07-12 19:58 ` Maneesh Soni
  0 siblings, 2 replies; 9+ messages in thread
From: Duetsch, Thomas  LDE1 @ 2006-07-12 11:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: maneesh, Steven Rostedt, mingo

Hi,

I'm currently working on a custom kernel based on Ingo's -rt patch
(2.6.16-rt29).

While rebooting my machine, I came across a kernel null pointer
dereference in this code segment in fs/sysfs/dir.c, function
sysfs_readdir():

		for (p=q->next; p!= &parent_sd->s_children; p=p->next) {
			struct sysfs_dirent *next;
			const char * name;
			int len;

			next = list_entry(p, struct sysfs_dirent,
					   s_sibling);
			if (!next->s_element)
				continue;

			name = sysfs_get_name(next);
			len = strlen(name);
			if (next->s_dentry)
PROBLEM ->			ino = next->s_dentry->d_inode->i_ino;
			else
				ino = iunique(sysfs_sb, 2);

Checking the mailing list, I came across this thread:
"What protection does sysfs_readdir have with SMP/Preemption?"
http://lkml.org/lkml/2005/11/22/293
Which handels the exact same problem (And I'm working on the kernel
Steve was working back then).
Reading through your suggestions and solutions, I was wondering, what
would happen if a sysfs file would be deleted instead of created, while
a sysfs_readdir were in progress.
Looking through the code, I don't see, where the parents inode mutex is
taken, to prevent a race condition.

Unfortunately, I can't reproduce the behaviour, nor do I know, which
file was accessed, when this happens.

Like Steve said back then, this might well be a problem in our code, but

since we didn't change the sysfs, maybe it's a vanilla problem as well.

Thomas


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-07-13  2:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-12 11:35 [SYSFS] Kernel Null pointer dereference in sysfs_readdir() Duetsch, Thomas  LDE1
2006-07-12 12:06 ` Steven Rostedt
2006-07-12 12:39   ` AW: " Duetsch, Thomas  LDE1
2006-07-12 14:06     ` Steven Rostedt
2006-07-12 19:57       ` Maneesh Soni
2006-07-12 20:28         ` Steven Rostedt
2006-07-12 20:39           ` Maneesh Soni
2006-07-13  2:59             ` Steven Rostedt
2006-07-12 19:58 ` Maneesh Soni

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