提交 25719e6b 编写于 作者: S Stefani Seibold 提交者: Greg Kroah-Hartman

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: NStefani Seibold <stefani@seibold.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 24bc7347
...@@ -386,12 +386,12 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) ...@@ -386,12 +386,12 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty)
dbg("%s - port %d", __func__, port->number); 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; 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); chars = kfifo_len(&port->write_fifo);
spin_unlock_irqrestore(&port->lock, flags);
dbg("%s - returns %d", __func__, chars); dbg("%s - returns %d", __func__, chars);
return chars; return chars;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册