From: Greg KH <greg@kroah.com>
To: torvalds@osdl.org
Cc: linux-usb-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [BK PATCH] Kobject Fix for 2.6.0-test11
Date: Thu, 11 Dec 2003 09:56:59 -0800 [thread overview]
Message-ID: <20031211175659.GA7815@kroah.com> (raw)
In-Reply-To: <20031211012731.GA10632@kroah.com>
On Wed, Dec 10, 2003 at 05:27:31PM -0800, Greg KH wrote:
>
> Here are some USB fixes for 2.6.0-test11. They all fix real bugs, and
> are 1-4 line fixes with the exception of the usb-serial close() fix,
> which is a bit larger, but has been well tested by a number of different
> users.
>
> Please pull from: bk://linuxusb.bkbits.net/gregkh-2.6
I've added the following patch to this repository. If you've already
pulled from here, feel free to just apply this single patch. Or you can
pull from that tree again, which ever is easier for you.
It fixes a kobject bug where the parent could be deleted before the
child object, causing all sorts of badness later when we clean up the
child object. It's been acked by Pat.
thanks,
greg k-h
Subject: kobject: fix bug where a parent could be deleted before a child device.
diff -Nru a/lib/kobject.c b/lib/kobject.c
--- a/lib/kobject.c Thu Dec 11 09:54:23 2003
+++ b/lib/kobject.c Thu Dec 11 09:54:23 2003
@@ -236,8 +236,6 @@
list_del_init(&kobj->entry);
up_write(&kobj->kset->subsys->rwsem);
}
- if (kobj->parent)
- kobject_put(kobj->parent);
kobject_put(kobj);
}
@@ -274,9 +272,11 @@
kobj->parent = parent;
error = create_dir(kobj);
- if (error)
+ if (error) {
unlink(kobj);
- else {
+ if (parent)
+ kobject_put(parent);
+ } else {
/* If this kobj does not belong to a kset,
try to find a parent that does. */
top_kobj = kobj;
@@ -452,6 +452,7 @@
{
struct kobj_type * t = get_ktype(kobj);
struct kset * s = kobj->kset;
+ struct kobject * parent = kobj->parent;
pr_debug("kobject %s: cleaning up\n",kobject_name(kobj));
if (kobj->k_name != kobj->name)
@@ -461,6 +462,8 @@
t->release(kobj);
if (s)
kset_put(s);
+ if (parent)
+ kobject_put(parent);
}
/**
prev parent reply other threads:[~2003-12-11 17:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-11 1:27 [BK PATCH] USB Fixes for 2.6.0-test11 Greg KH
2003-12-11 1:29 ` [PATCH] " Greg KH
2003-12-11 1:29 ` Greg KH
2003-12-11 1:29 ` Greg KH
2003-12-11 1:29 ` Greg KH
2003-12-11 1:29 ` Greg KH
2003-12-11 1:29 ` Greg KH
2003-12-11 1:29 ` Greg KH
2003-12-11 1:29 ` Greg KH
2003-12-11 1:29 ` Greg KH
2003-12-11 1:29 ` Greg KH
2003-12-11 1:29 ` Greg KH
2003-12-11 17:56 ` Greg KH [this message]
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=20031211175659.GA7815@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=torvalds@osdl.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