[PATCH v4 0/4] serial: fix ioctl hangup race

From: Johan Hovold

Date: Thu Sep 10 2026 - 09:20:24 EST


The tty ioctls can race with hangup and end up calling into a tty
driver for a device that is already gone or powered down.

Included since v3 are also two related fixes for issues highlighted by
Sashiko.

Johan


Changes in v4
- include TIOCSETD which also access hardware

Changes in v3
- revert guards in uart_wait_modem_status()
- fix race in TIOCMIWAIT (new)
- abort TIOCMIWAIT on hangup (new)

Changes in v2
- include TIOCMIWAIT which also access hardware
- replace broken scoped_guard() construct in wait loop


Johan Hovold (4):
serial: revert guards in uart_wait_modem_status()
serial: fix ioctl hangup race
serial: fix TIOCMIWAIT race
serial: abort TIOCMIWAIT on hangup

drivers/tty/serial/serial_core.c | 59 ++++++++++++++++++++++----------
1 file changed, 41 insertions(+), 18 deletions(-)

--
2.55.0