diff options
author | Stefani Seibold <stefani@seibold.net> | 2010-01-05 08:30:31 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-01-20 18:24:33 -0500 |
commit | 25719e6b4631959c9ecb1db6967537a124c4a7fa (patch) | |
tree | 3f7b5e2ad2f11b48d3c28b6ed8bea1bf5244ae2f /drivers/usb/serial/generic.c | |
parent | 24bc7347da73a9ed3383056c3d0f28c0e361621e (diff) |
USB: serial: fix USB serial fix kfifo_len locking
This patch fix a possible race bug in drivers/usb/serial/generic with
the new kfifo API.
Please apply it to the 2.6.33-rc* tree.
Signed-off-by: Stefani Seibold <stefani@seibold.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/generic.c')
-rw-r--r-- | drivers/usb/serial/generic.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index f1ea3a33b6e6..5ce033ab9b99 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -386,12 +386,12 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) | |||
386 | 386 | ||
387 | dbg("%s - port %d", __func__, port->number); | 387 | dbg("%s - port %d", __func__, port->number); |
388 | 388 | ||
389 | if (serial->type->max_in_flight_urbs) { | 389 | spin_lock_irqsave(&port->lock, flags); |
390 | spin_lock_irqsave(&port->lock, flags); | 390 | if (serial->type->max_in_flight_urbs) |
391 | chars = port->tx_bytes_flight; | 391 | chars = port->tx_bytes_flight; |
392 | spin_unlock_irqrestore(&port->lock, flags); | 392 | else if (serial->num_bulk_out) |
393 | } else if (serial->num_bulk_out) | ||
394 | chars = kfifo_len(&port->write_fifo); | 393 | chars = kfifo_len(&port->write_fifo); |
394 | spin_unlock_irqrestore(&port->lock, flags); | ||
395 | 395 | ||
396 | dbg("%s - returns %d", __func__, chars); | 396 | dbg("%s - returns %d", __func__, chars); |
397 | return chars; | 397 | return chars; |