From: <gregkh@suse.de>
To: oliver@neukum.org, gregkh@suse.de, jeremy@goop.org,
linux-kernel@vger.kernel.org,
linux-usb-devel@lists.sourceforge.net, linux@sierrawireless.com,
oneukum@suse.de, stern@rowland.harvard.edu
Subject: patch usb-fix-bug-sleeping-function-called-from-invalid-context-at-home-jeremy-hg-xen-paravirt-linux-drivers-usb-core-urb.c-524-in_atomic-1-irqs_disabled-0.patch added to gregkh-2.6 tree
Date: Mon, 30 Jul 2007 12:13:55 -0700 [thread overview]
Message-ID: <20070730191403.AFF4014458DB@imap.suse.de> (raw)
In-Reply-To: <200707241513.42892.oliver@neukum.org>
This is a note to let you know that I've just added the patch titled
Subject: USB: fix BUG: sleeping function called from invalid context at /home/jeremy/hg/xen/paravirt/linux/drivers/usb/core/urb.c:524, in_atomic():1, irqs_disabled():0
to my gregkh-2.6 tree. Its filename is
usb-fix-bug-sleeping-function-called-from-invalid-context-at-home-jeremy-hg-xen-paravirt-linux-drivers-usb-core-urb.c-524-in_atomic-1-irqs_disabled-0.patch
This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/
>From oliver@neukum.org Tue Jul 24 06:11:50 2007
From: Oliver Neukum <oliver@neukum.org>
Date: Tue, 24 Jul 2007 15:13:42 +0200
Subject: USB: fix BUG: sleeping function called from invalid context at /home/jeremy/hg/xen/paravirt/linux/drivers/usb/core/urb.c:524, in_atomic():1, irqs_disabled():0
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>, Kevin Lloyd <linux@sierrawireless.com>, Greg KH <gregkh@suse.de>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, USB development list <linux-usb-devel@lists.sourceforge.net>
Message-ID: <200707241513.42892.oliver@neukum.org>
Content-Disposition: inline
Clearly there's a bug in
drivers/usb/serial/usb-serial.c:usb_serial_put(). It shouldn't call
kref_put() while holding a spinlock.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/usb/serial/usb-serial.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -60,19 +60,19 @@ static struct usb_driver usb_serial_driv
static int debug;
static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */
-static spinlock_t table_lock;
+static DEFINE_MUTEX(table_lock);
static LIST_HEAD(usb_serial_driver_list);
struct usb_serial *usb_serial_get_by_index(unsigned index)
{
struct usb_serial *serial;
- spin_lock(&table_lock);
+ mutex_lock(&table_lock);
serial = serial_table[index];
if (serial)
kref_get(&serial->kref);
- spin_unlock(&table_lock);
+ mutex_unlock(&table_lock);
return serial;
}
@@ -84,7 +84,7 @@ static struct usb_serial *get_free_seria
dbg("%s %d", __FUNCTION__, num_ports);
*minor = 0;
- spin_lock(&table_lock);
+ mutex_lock(&table_lock);
for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
if (serial_table[i])
continue;
@@ -106,10 +106,10 @@ static struct usb_serial *get_free_seria
serial_table[i] = serial;
serial->port[j++]->number = i;
}
- spin_unlock(&table_lock);
+ mutex_unlock(&table_lock);
return serial;
}
- spin_unlock(&table_lock);
+ mutex_unlock(&table_lock);
return NULL;
}
@@ -172,9 +172,9 @@ static void destroy_serial(struct kref *
void usb_serial_put(struct usb_serial *serial)
{
- spin_lock(&table_lock);
+ mutex_lock(&table_lock);
kref_put(&serial->kref, destroy_serial);
- spin_unlock(&table_lock);
+ mutex_unlock(&table_lock);
}
/*****************************************************************************
@@ -1129,7 +1129,6 @@ static int __init usb_serial_init(void)
return -ENOMEM;
/* Initialize our global data */
- spin_lock_init(&table_lock);
for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
serial_table[i] = NULL;
}
Patches currently in gregkh-2.6 which might be from oliver@neukum.org are
usb/usb-fix-bug-sleeping-function-called-from-invalid-context-at-home-jeremy-hg-xen-paravirt-linux-drivers-usb-core-urb.c-524-in_atomic-1-irqs_disabled-0.patch
usb/usb-nikon-d50-is-an-unusual-device.patch
usb/usb-yet-another-quirky-device.patch
usb/usb-more-quirky-devices.patch
prev parent reply other threads:[~2007-07-30 19:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-23 20:16 2.6.22+: BUG: sleeping function called from invalid context at /home/jeremy/hg/xen/paravirt/linux/drivers/usb/core/urb.c:524,in_atomic():1, irqs_disabled():0 Jeremy Fitzhardinge
2007-07-23 20:50 ` [linux-usb-devel] 2.6.22+: BUG: sleeping function called from invalid context at /home/jeremy/hg/xen/paravirt/linux/drivers/usb/core/urb.c:524, in_atomic():1, irqs_disabled():0 Alan Stern
2007-07-23 22:57 ` Greg KH
2007-07-24 8:06 ` Oliver Neukum
2007-07-24 13:13 ` Oliver Neukum
2007-07-30 19:13 ` gregkh [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=20070730191403.AFF4014458DB@imap.suse.de \
--to=gregkh@suse.de \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=linux@sierrawireless.com \
--cc=oliver@neukum.org \
--cc=oneukum@suse.de \
--cc=stern@rowland.harvard.edu \
/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