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>

authored by Stefani Seibold and committed by Greg Kroah-Hartman 25719e6b 24bc7347

+4 -4
+4 -4
drivers/usb/serial/generic.c
··· 386 386 387 387 dbg("%s - port %d", __func__, port->number); 388 388 389 - if (serial->type->max_in_flight_urbs) { 390 - spin_lock_irqsave(&port->lock, flags); 389 + spin_lock_irqsave(&port->lock, flags); 390 + if (serial->type->max_in_flight_urbs) 391 391 chars = port->tx_bytes_flight; 392 - spin_unlock_irqrestore(&port->lock, flags); 393 - } else if (serial->num_bulk_out) 392 + else if (serial->num_bulk_out) 394 393 chars = kfifo_len(&port->write_fifo); 394 + spin_unlock_irqrestore(&port->lock, flags); 395 395 396 396 dbg("%s - returns %d", __func__, chars); 397 397 return chars;