From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: 76306.1226@compuserve.com
Subject: [PATCH] kobject: don't oops on null kobject.name
Date: Mon, 6 Feb 2006 12:29:17 -0800 [thread overview]
Message-ID: <11392577571177@kroah.com> (raw)
In-Reply-To: <1139257757388@kroah.com>
[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 <gregkh@suse.de>
---
commit b365b3daf2a9e2a8b002ea9fef877af1c71513fd
tree dcd673d830b61ee37ab433af60c0f81ffaa86779
parent c171fef5c8566cf5f57877e7832fa696ecdf5228
author Chuck Ebbert <76306.1226@compuserve.com> Thu, 12 Jan 2006 20:02:00 -0500
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:17 -0800
lib/kobject.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/lib/kobject.c b/lib/kobject.c
index fe4ae36..efe67fa 100644
--- a/lib/kobject.c
+++ b/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;
next prev parent reply other threads:[~2006-02-06 20:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-06 20:28 [GIT PATCH] Driver Core fixes for 2.6.16-rc2 Greg KH
2006-02-06 20:29 ` [PATCH] Fix Userspace interface breakage in power/state Greg KH
2006-02-06 20:29 ` [PATCH] DRM: fix up classdev interface for drm core Greg KH
2006-02-06 20:29 ` [PATCH] IB: fix up major/minor sysfs interface for IB core Greg KH
2006-02-06 20:29 ` [PATCH] SPI: spi_butterfly, restore lost deltas Greg KH
2006-02-06 20:29 ` Greg KH [this message]
2006-02-06 20:29 ` [PATCH] kobject_add() must have a valid name in order to succeed Greg KH
2006-02-06 20:29 ` [PATCH] Fix compiler warning in driver core for CONFIG_HOTPLUG=N Greg KH
2006-02-06 20:29 ` [PATCH] drivers/base/: proper prototypes Greg KH
2006-02-06 20:29 ` [PATCH] debugfs: trivial comment fix Greg KH
2006-02-06 20:29 ` [PATCH] Fix uevent buffer overflow in input layer Greg KH
-- strict thread matches above, loose matches on Subject: below --
2006-01-14 16:18 [patch] kobject: don't oops on null kobject.name Chuck Ebbert
2006-01-14 3:07 Chuck Ebbert
2006-01-14 3:44 ` Greg KH
2006-01-14 3:07 Chuck Ebbert
2006-01-13 1:02 Chuck Ebbert
2006-01-13 22:30 ` Andrew Morton
2006-01-13 22:55 ` Greg KH
2006-01-13 23:12 ` Andrew Morton
2006-01-14 0:02 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11392577571177@kroah.com \
--to=gregkh@suse.de \
--cc=76306.1226@compuserve.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox