[PATCH v4 4/4] serial: abort TIOCMIWAIT on hangup

From: Johan Hovold

Date: Thu Sep 10 2026 - 09:33:10 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 f7b30f77b231..33c8f3b6ac81 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