linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] base/class.c: prevent ooops due to insert/remove race
@ 2007-11-29  4:00 Mark Lord
  2007-11-29  4:33 ` Greg KH
  0 siblings, 1 reply; 27+ messages in thread
From: Mark Lord @ 2007-11-29  4:00 UTC (permalink / raw)
  To: Linux Kernel, Greg KH, Andrew Morton

While doing insert/remove (quickly) tests on USB, I managed to trigger
an Oops on 2.6.23.1 on the call to strlen() in make_class_name().

This patch prevents this oops.

There is still the larger problem of the overall race
that caused this in the first place, but much of the rest
of the code in class.c appears to also do NULL checks to
avoid Oops'ing, so this continues the tradition.

Signed-off-by:  Mark Lord <mlord@pobox.com>
---

Patch applies to both 2.6.24 and 2.6.23.

--- old/drivers/base/class.c	2007-11-28 22:54:59.000000000 -0500
+++ linux/drivers/base/class.c	2007-11-28 22:54:48.000000000 -0500
@@ -354,6 +354,8 @@
 	char *class_name;
 	int size;
 
+	if (!name)
+		return NULL;
 	size = strlen(name) + strlen(kobject_name(kobj)) + 2;
 
 	class_name = kmalloc(size, GFP_KERNEL);

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

end of thread, other threads:[~2007-11-30  2:58 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-29  4:00 [PATCH] base/class.c: prevent ooops due to insert/remove race Mark Lord
2007-11-29  4:33 ` Greg KH
2007-11-29 15:41   ` Mark Lord
2007-11-29 16:27     ` Greg KH
2007-11-29 17:45       ` Mark Lord
2007-11-29 17:48         ` Mark Lord
2007-11-29 17:50           ` Mark Lord
2007-11-29 18:09             ` [PATCH] base/class.c: prevent ooops due to insert/remove race (v3) Mark Lord
2007-11-29 18:12               ` Mark Lord
2007-11-29 19:20                 ` [linux-usb-devel] " Alan Stern
2007-11-29 20:01                   ` Mark Lord
2007-11-29 20:12                     ` Greg KH
     [not found]                       ` <474F1DB3.4030900@rtr.ca>
2007-11-29 20:25                         ` Mark Lord
2007-11-29 20:32                           ` Greg KH
2007-11-29 20:46                             ` Mark Lord
2007-11-29 21:17                               ` Greg KH
2007-11-29 22:07                               ` Alan Stern
2007-11-29 22:11                                 ` Greg KH
2007-11-29 22:28                                 ` Mark Lord
2007-11-29 22:43                                   ` Alan Stern
2007-11-29 23:09                                 ` Linus Torvalds
2007-11-30  2:58                                   ` Alan Stern
2007-11-29 20:13                     ` Alan Stern
2007-11-29 20:17                       ` Mark Lord
2007-11-29 20:20                       ` Mark Lord
2007-11-29 21:59                         ` Alan Stern
2007-11-29 15:59   ` [PATCH] base/class.c: prevent ooops due to insert/remove race (v2) Mark Lord

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).