From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: gregkh@suse.de
Subject: [PATCH] kobject_add() must have a valid name in order to succeed.
Date: Mon, 6 Feb 2006 12:29:17 -0800 [thread overview]
Message-ID: <11392577571272@kroah.com> (raw)
In-Reply-To: <11392577571177@kroah.com>
[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 <gregkh@suse.de>
---
commit c171fef5c8566cf5f57877e7832fa696ecdf5228
tree c599efed9172ce2f31835d4df01936063fad3a77
parent e3f749c4af69c4344d89f11e2293e3790eb4eaca
author Greg Kroah-Hartman <gregkh@suse.de> Fri, 20 Jan 2006 14:08:59 -0800
committer Greg Kroah-Hartman <gregkh@suse.de> Mon, 06 Feb 2006 12:17:17 -0800
lib/kobject.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/kobject.c b/lib/kobject.c
index 7a0e680..fe4ae36 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",
next prev parent reply other threads:[~2006-02-06 20:29 UTC|newest]
Thread overview: 11+ 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 ` [PATCH] kobject: don't oops on null kobject.name Greg KH
2006-02-06 20:29 ` Greg KH [this message]
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
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=11392577571272@kroah.com \
--to=gregkh@suse.de \
--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