[PATCH v3 4/4] serial: abort TIOCMIWAIT on hangup
From: Johan Hovold
Date: Mon Sep 07 2026 - 02:47:07 EST
Add the missing hangup check to the TIOCMIWAIT wait loop to avoid going
back to sleep (indefinitely) after being woken on hangup.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: sashiko-bot@xxxxxxxxxx
Link: https://lore.kernel.org/r/20260904115542.E20D11F00A3D@xxxxxxxxxxxxxxx
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
---
drivers/tty/serial/serial_core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index c2c2c8fe1a4c..45d160743ea0 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1244,6 +1244,11 @@ static int uart_wait_modem_status(struct tty_struct *tty, struct uart_state *sta
break;
}
+ if (tty_io_error(tty)) {
+ ret = -EIO;
+ break;
+ }
+
schedule();
/* see if a signal did it */
--
2.55.0