[PATCH v2 10/15] USB: oti6858: fix TIOCMIWAIT and disconnect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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/oti6858.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index a958fd4..9dbd64d 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -354,6 +354,9 @@ static int oti6858_port_remove(struct usb_serial_port *port)
 	struct oti6858_private *priv;
 
 	priv = usb_get_serial_port_data(port);
+
+	wake_up_interruptible(&priv->intr_wait);
+
 	kfree(priv);
 
 	return 0;
@@ -665,10 +668,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
 
 	while (1) {
 		wait_event_interruptible(priv->intr_wait,
+					port->serial->disconnected ||
 					priv->status.pin_state != prev);
 		if (signal_pending(current))
 			return -ERESTARTSYS;
 
+		if (port->serial->disconnected)
+			return -EIO;
+
 		spin_lock_irqsave(&priv->lock, flags);
 		status = priv->status.pin_state & PIN_MASK;
 		spin_unlock_irqrestore(&priv->lock, flags);
-- 
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


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]