Skip to content

Commit

Permalink
USB: serial: fix USB serial fix kfifo_len locking
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
sstefani authored and gregkh committed Jan 20, 2010
1 parent 24bc734 commit 25719e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/usb/serial/generic.c
Expand Up @@ -386,12 +386,12 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty)

dbg("%s - port %d", __func__, port->number);

if (serial->type->max_in_flight_urbs) {
spin_lock_irqsave(&port->lock, flags);
spin_lock_irqsave(&port->lock, flags);
if (serial->type->max_in_flight_urbs)
chars = port->tx_bytes_flight;
spin_unlock_irqrestore(&port->lock, flags);
} else if (serial->num_bulk_out)
else if (serial->num_bulk_out)
chars = kfifo_len(&port->write_fifo);
spin_unlock_irqrestore(&port->lock, flags);

dbg("%s - returns %d", __func__, chars);
return chars;
Expand Down

0 comments on commit 25719e6

Please sign in to comment.