提交 50dbb852 编写于 作者: J Johan Hovold 提交者: Greg Kroah-Hartman

USB: serial: fix missing locking on fifo in write callback

On errors the fifo was reset without any locking. This could race with
write which do kfifo_put and perhaps also chars_in_buffer and write_room.

Every other access to the fifo is protected using the port lock so
better add it to the error path as well.
Signed-off-by: NJohan Hovold <jhovold@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 30af7fb5
......@@ -519,10 +519,13 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb)
port->write_urb_busy = 0;
spin_unlock_irqrestore(&port->lock, flags);
if (status)
if (status) {
spin_lock_irqsave(&port->lock, flags);
kfifo_reset_out(&port->write_fifo);
else
spin_unlock_irqrestore(&port->lock, flags);
} else {
usb_serial_generic_write_start(port);
}
}
if (status)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册