diff options
author | Borislav Petkov <bbpetkov@yahoo.de> | 2007-10-28 08:24:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-28 16:58:34 -0500 |
commit | bfaeafcfc2242277e31cc1cfae687afaac0cd9ec (patch) | |
tree | 15b6a182df4e0d2d15a26a9c10124b7ec18e82a3 /drivers/usb | |
parent | ed206ec9ab398e1c3756ff0eb9507db1d009e65f (diff) |
usbserial: fix inconsistent lock state
In commit acd2a847e7fee7df11817f67dba75a2802793e5d usb_serial_generic_write()
disables interrupts when taking &port->lock which is also taken in
usb_serial_generic_read_bulk_callback() resulting in an inconsistent lock state
due to the latter not disabling interrupts on the local cpu. Fix that by
disabling interrupts in the latter call site also.
Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/generic.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 9eb4a65ee4d9..d41531139c55 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -327,6 +327,7 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb) | |||
327 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 327 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
328 | unsigned char *data = urb->transfer_buffer; | 328 | unsigned char *data = urb->transfer_buffer; |
329 | int status = urb->status; | 329 | int status = urb->status; |
330 | unsigned long flags; | ||
330 | 331 | ||
331 | dbg("%s - port %d", __FUNCTION__, port->number); | 332 | dbg("%s - port %d", __FUNCTION__, port->number); |
332 | 333 | ||
@@ -339,11 +340,11 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb) | |||
339 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); | 340 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); |
340 | 341 | ||
341 | /* Throttle the device if requested by tty */ | 342 | /* Throttle the device if requested by tty */ |
342 | spin_lock(&port->lock); | 343 | spin_lock_irqsave(&port->lock, flags); |
343 | if (!(port->throttled = port->throttle_req)) | 344 | if (!(port->throttled = port->throttle_req)) |
344 | /* Handle data and continue reading from device */ | 345 | /* Handle data and continue reading from device */ |
345 | flush_and_resubmit_read_urb(port); | 346 | flush_and_resubmit_read_urb(port); |
346 | spin_unlock(&port->lock); | 347 | spin_unlock_irqrestore(&port->lock, flags); |
347 | } | 348 | } |
348 | EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); | 349 | EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); |
349 | 350 | ||