From 76306.1226@compuserve.com Mon Jan 16 14:06:48 2006 Date: Thu, 12 Jan 2006 20:02:00 -0500 From: Chuck Ebbert <76306.1226@compuserve.com> Subject: kobject: don't oops on null kobject.name To: Greg KH Message-ID: <200601122004_MC3-1-B5C5-4B72@compuserve.com> Content-Disposition: inline kobject_get_path() will oops if one of the component names is NULL. Fix that by returning NULL instead of oopsing. Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com> Signed-off-by: Greg Kroah-Hartman --- lib/kobject.c | 4 ++++ 1 file changed, 4 insertions(+) --- gregkh-2.6.orig/lib/kobject.c +++ gregkh-2.6/lib/kobject.c @@ -72,6 +72,8 @@ static int get_kobj_path_length(struct k * Add 1 to strlen for leading '/' of each level. */ do { + if (kobject_name(parent) == NULL) + return 0; length += strlen(kobject_name(parent)) + 1; parent = parent->parent; } while (parent); @@ -107,6 +109,8 @@ char *kobject_get_path(struct kobject *k int len; len = get_kobj_path_length(kobj); + if (len == 0) + return NULL; path = kmalloc(len, gfp_mask); if (!path) return NULL;