From c171fef5c8566cf5f57877e7832fa696ecdf5228 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jan 2006 14:08:59 -0800 Subject: [PATCH] kobject_add() must have a valid name in order to succeed. So we might as well check to verify this, and let the user know that something is wrong if they didn't do it correctly, instead of oopsing later on in kobject_get_name() or somewhere else. Signed-off-by: Greg Kroah-Hartman --- lib/kobject.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/kobject.c b/lib/kobject.c index 7a0e6809490d..fe4ae36ce960 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -162,6 +162,11 @@ int kobject_add(struct kobject * kobj) return -ENOENT; if (!kobj->k_name) kobj->k_name = kobj->name; + if (!kobj->k_name) { + pr_debug("kobject attempted to be registered with no name!\n"); + WARN_ON(1); + return -EINVAL; + } parent = kobject_get(kobj->parent); pr_debug("kobject %s: registering. parent: %s, set: %s\n", -- cgit v1.2.3-59-g8ed1b From b365b3daf2a9e2a8b002ea9fef877af1c71513fd Mon Sep 17 00:00:00 2001 From: Chuck Ebbert <76306.1226@compuserve.com> Date: Thu, 12 Jan 2006 20:02:00 -0500 Subject: [PATCH] kobject: don't oops on null kobject.name 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(+) (limited to 'lib') diff --git a/lib/kobject.c b/lib/kobject.c index fe4ae36ce960..efe67fa96a71 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -72,6 +72,8 @@ static int get_kobj_path_length(struct kobject *kobj) * 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 *kobj, gfp_t gfp_mask) int len; len = get_kobj_path_length(kobj); + if (len == 0) + return NULL; path = kmalloc(len, gfp_mask); if (!path) return NULL; -- cgit v1.2.3-59-g8ed1b From d87499ed1a3ba0f6dbcff8d91c96ef132c115d08 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Wed, 25 Jan 2006 10:21:32 +1100 Subject: [PATCH] Fix uevent buffer overflow in input layer The buffer used for kobject uevent is too small for some of the events generated by the input layer. Bump it to 2k. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Greg Kroah-Hartman --- lib/kobject_uevent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index f56e27ae9d52..1b1985c136ec 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -22,7 +22,7 @@ #include #include -#define BUFFER_SIZE 1024 /* buffer for the variables */ +#define BUFFER_SIZE 2048 /* buffer for the variables */ #define NUM_ENVP 32 /* number of env pointers */ #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) -- cgit v1.2.3-59-g8ed1b