* [PATCH] tty: amiserial: fix broken TIOCMIWAIT
@ 2026-09-11 9:01 Johan Hovold
2026-09-11 9:06 ` Jiri Slaby
2026-09-11 9:17 ` sashiko-bot
0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2026-09-11 9:01 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby
Cc: linux-serial, linux-kernel, Johan Hovold, sashiko-bot, stable,
Arnd Bergmann
A change replacing interruptible_sleep_on() inadvertently broke the
TIOCMIWAIT implementation which now immediately returns -EIO (unless
there is a racing modem status update).
Replace the old hangup (and signal) detection with a check for the
TTY_IO_ERROR flag which is set on hangup.
Fixes: 591cee0a3563 ("tty/amiserial: avoid interruptible_sleep_on")
Reported-by: sashiko-bot@kernel.org
Link: https://lore.kernel.org/20260910132029.D80801F00898@smtp.kernel.org
Cc: stable@vger.kernel.org # 3.14
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/tty/amiserial.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 28af0fd98181..60f6060b893d 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1138,11 +1138,6 @@ static int rs_ioctl(struct tty_struct *tty,
local_irq_save(flags);
cnow = info->icount; /* atomic copy */
local_irq_restore(flags);
- if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
- cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) {
- ret = -EIO; /* no change => error */
- break;
- }
if ( ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
@@ -1150,6 +1145,10 @@ static int rs_ioctl(struct tty_struct *tty,
ret = 0;
break;
}
+ if (tty_io_error(tty)) {
+ ret = -EIO;
+ break;
+ }
schedule();
/* see if a signal did it */
if (signal_pending(current)) {
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: amiserial: fix broken TIOCMIWAIT
2026-09-11 9:01 [PATCH] tty: amiserial: fix broken TIOCMIWAIT Johan Hovold
@ 2026-09-11 9:06 ` Jiri Slaby
2026-09-11 9:17 ` sashiko-bot
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2026-09-11 9:06 UTC (permalink / raw)
To: Johan Hovold, Greg Kroah-Hartman
Cc: linux-serial, linux-kernel, sashiko-bot, stable, Arnd Bergmann
On 11. 09. 26, 11:01, Johan Hovold wrote:
> A change replacing interruptible_sleep_on() inadvertently broke the
> TIOCMIWAIT implementation which now immediately returns -EIO (unless
> there is a racing modem status update).
>
> Replace the old hangup (and signal) detection with a check for the
> TTY_IO_ERROR flag which is set on hangup.
You seem you opened a can of worms.
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
> Fixes: 591cee0a3563 ("tty/amiserial: avoid interruptible_sleep_on")
> Reported-by: sashiko-bot@kernel.org
> Link: https://lore.kernel.org/20260910132029.D80801F00898@smtp.kernel.org
> Cc: stable@vger.kernel.org # 3.14
> Cc: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/tty/amiserial.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
> index 28af0fd98181..60f6060b893d 100644
> --- a/drivers/tty/amiserial.c
> +++ b/drivers/tty/amiserial.c
> @@ -1138,11 +1138,6 @@ static int rs_ioctl(struct tty_struct *tty,
> local_irq_save(flags);
> cnow = info->icount; /* atomic copy */
> local_irq_restore(flags);
> - if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
> - cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) {
> - ret = -EIO; /* no change => error */
> - break;
> - }
> if ( ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
> ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
> ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
> @@ -1150,6 +1145,10 @@ static int rs_ioctl(struct tty_struct *tty,
> ret = 0;
> break;
> }
> + if (tty_io_error(tty)) {
> + ret = -EIO;
> + break;
> + }
> schedule();
> /* see if a signal did it */
> if (signal_pending(current)) {
--
js
suse labs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: amiserial: fix broken TIOCMIWAIT
2026-09-11 9:01 [PATCH] tty: amiserial: fix broken TIOCMIWAIT Johan Hovold
2026-09-11 9:06 ` Jiri Slaby
@ 2026-09-11 9:17 ` sashiko-bot
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-09-11 9:17 UTC (permalink / raw)
To: Johan Hovold; +Cc: linux-serial
> A change replacing interruptible_sleep_on() inadvertently broke the
> TIOCMIWAIT implementation which now immediately returns -EIO (unless
> there is a racing modem status update).
>
> Replace the old hangup (and signal) detection with a check for the
> TTY_IO_ERROR flag which is set on hangup.
>
> Fixes: 591cee0a3563 ("tty/amiserial: avoid interruptible_sleep_on")
> Reported-by: sashiko-bot@kernel.org
> Link: https://lore.kernel.org/20260910132029.D80801F00898@smtp.kernel.org
> Cc: stable@vger.kernel.org # 3.14
> Cc: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Johan Hovold <johan@kernel.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260911090132.723531-1-johan@kernel.org?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-11 9:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-11 9:01 [PATCH] tty: amiserial: fix broken TIOCMIWAIT Johan Hovold
2026-09-11 9:06 ` Jiri Slaby
2026-09-11 9:17 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox