[PATCH] usb: serial: return -ENODEV if disconnected during TIOCMIWAIT

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

 



Disconnecting a device is not just a hang up. The device is gone.
We should tell user space the truth immediately.

Signed-off-by: Oliver Neukum <oneukum@xxxxxxxx>
---
 drivers/usb/serial/generic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 54e170d..147696d 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -505,6 +505,10 @@ int usb_serial_generic_tiocmiwait(struct tty_struct *tty, unsigned long arg)
 			usb_serial_generic_msr_changed(tty, arg, &cnow));
 	if (!ret && !test_bit(ASYNCB_INITIALIZED, &port->port.flags))
 		ret = -EIO;
+	mutex_lock(&port->serial->disc_mutex);
+	if (port->serial->disconnected)
+		ret = -ENODEV;
+	mutex_unlock(&port->serial->disc_mutex);
 
 	return ret;
 }
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux