mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 15:32:04 +02:00
tty: amiserial: fix broken TIOCMIWAIT
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: 591cee0a35 ("tty/amiserial: avoid interruptible_sleep_on")
Reported-by: sashiko-bot@kernel.org
Link: https://lore.kernel.org/20260910132029.D80801F00898@smtp.kernel.org
Cc: stable@kernel.org # 3.14
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Link: https://patch.msgid.link/20260911090132.723531-1-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
eb35b73e13
commit
615f35fd5a
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user