[lkml]   [2007]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] base/class.c: prevent ooops due to insert/remove race
While doing insert/remove (quickly) tests on USB, I managed to trigger
an Oops on 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 <>
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);
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at
 \ /
  Last update: 2007-11-29 05:03    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean