Make sure to wake up any process sleeping on the modem-status-change queue at port remove. Currently a process waiting on modem status changes will not necessarily be woken on device disconnect as wake_up was called from dtr_rts which isn't guaranteed to be called (e.g. if HUPCL is not set). Note that we need to use the disconnected flag to detect disconnect as the port private data may have been freed when woken up. Cc: stable <stable@xxxxxxxxxxxxxxx> Signed-off-by: Johan Hovold <jhovold@xxxxxxxxx> --- drivers/usb/serial/ch341.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index d255f66..f79ea70 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -272,6 +272,7 @@ static int ch341_port_remove(struct usb_serial_port *port) struct ch341_private *priv; priv = usb_get_serial_port_data(port); + wake_up_interruptible(&priv->delta_msr_wait); kfree(priv); return 0; @@ -298,7 +299,6 @@ static void ch341_dtr_rts(struct usb_serial_port *port, int on) priv->line_control &= ~(CH341_BIT_RTS | CH341_BIT_DTR); spin_unlock_irqrestore(&priv->lock, flags); ch341_set_handshake(port->serial->dev, priv->line_control); - wake_up_interruptible(&priv->delta_msr_wait); } static void ch341_close(struct usb_serial_port *port) @@ -522,6 +522,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) if (signal_pending(current)) return -ERESTARTSYS; + if (port->serial->disconnected) + return -EIO; + spin_lock_irqsave(&priv->lock, flags); status = priv->line_status; multi_change = priv->multi_status_change; -- 1.8.1.1 -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html