Linux Serial subsystem development
 help / color / mirror / Atom feed
* [BUG] tty: TCIOFF/TCION under TCOOFF lose the character on pty and vt
@ 2026-11-15 16:36 Cheng Yongkang
  0 siblings, 0 replies; only message in thread
From: Cheng Yongkang @ 2026-11-15 16:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-serial, linux-kernel

Hi Greg, Jiri,

I hit a small corner case in tty_send_xchar(). It only happens on a
pty or the vt console after output was suspended with TCOOFF, so it
may not be worth fixing.

Under TCOOFF, tcflow(TCIOFF) and tcflow(TCION) still send the STOP or
START character on most ttys. serial_core UARTs do it through
->send_xchar(). Drivers without ->send_xchar() go through
->write(): __start_tty() does nothing while tco_stopped is set, but
usb-serial, cdc-acm and u_serial do not check the stopped state in
->write(), so the character still goes out.

pty_write() and the vt console's write return 0 while the tty is
stopped, though. tty_send_xchar() ignores that and returns 0, so on a
pty or vt the call reports success but the character is never sent,
not even after TCOON.

On v7.3, with TCOOFF in effect, TCIOFF and TCION returned 0 on all of
these. 8250, ftdi_sio, cdc-acm and u_serial delivered the character
before TCOON. pty and vt delivered nothing, before or after TCOON.
The code is unchanged in next-20261113.

tty_send_xchar() could return an error such as -EIO when the write
took no byte. Since usb-serial and u_serial also return 0 when their
FIFO is full, that should probably be limited to the case where the
tty is stopped. I can send a patch if you want one.

Thanks,
Cheng Yongkang

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-15 16:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-15 16:36 [BUG] tty: TCIOFF/TCION under TCOOFF lose the character on pty and vt Cheng Yongkang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox