From: Greg KH <greg@kroah.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: James.Bottomley@steeleye.com
Subject: Re: [PATCH] Fix removable USB drive oops
Date: Wed, 17 Mar 2004 16:58:38 -0800 [thread overview]
Message-ID: <20040318005838.GA25884@kroah.com> (raw)
In-Reply-To: <200403141810.i2EIAtK9032222@hera.kernel.org>
On Sat, Mar 13, 2004 at 06:48:36PM +0000, Linux Kernel Mailing List wrote:
> ChangeSet 1.1623, 2004/03/13 13:48:36-05:00, James.Bottomley@steeleye.com
>
> [PATCH] Fix removable USB drive oops
>
> The actual problem reported was because there wasn't a corresponding
> check on transport_classdev.class in the unregister.
>
> However, on closer inspection I also turned up a nasty thinko in the
> reference counting. For reasons best known to the class code authors,
> class devices have to obtain their own references to the devices they're
> attached to which they release again in their .release routines, so you
> have to remember to do a get_device() in the correct place after the
> class_device_add(). I put comments in the code so that, hopefully, we
> can avoid the problem in future.
Bah, this was my fault, sorry.
Here's a patch that should fix this, and prevent you from needing this
patch. Can you verify this?
thanks,
greg k-h
# Driver class: remove possible oops
#
# This happens when the device associated with a class device goes away before
# the class does.
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
--- a/drivers/base/class.c Wed Mar 17 16:57:10 2004
+++ b/drivers/base/class.c Wed Mar 17 16:57:10 2004
@@ -155,8 +155,7 @@
static void class_device_dev_unlink(struct class_device * class_dev)
{
- if (class_dev->dev)
- sysfs_remove_link(&class_dev->kobj, "device");
+ sysfs_remove_link(&class_dev->kobj, "device");
}
static int class_device_driver_link(struct class_device * class_dev)
@@ -169,8 +168,7 @@
static void class_device_driver_unlink(struct class_device * class_dev)
{
- if ((class_dev->dev) && (class_dev->dev->driver))
- sysfs_remove_link(&class_dev->kobj, "driver");
+ sysfs_remove_link(&class_dev->kobj, "driver");
}
next parent reply other threads:[~2004-03-18 0:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200403141810.i2EIAtK9032222@hera.kernel.org>
2004-03-18 0:58 ` Greg KH [this message]
2004-03-18 13:36 ` James Bottomley
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=20040318005838.GA25884@kroah.com \
--to=greg@kroah.com \
--cc=James.Bottomley@steeleye.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
all inboxes | Powered by JetHome®