mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] tty/serial: Fix tcsetattr() TCSADRAIN/FLUSH and write() races
@ 2023-03-17 11:33 Ilpo Järvinen
  2023-03-17 11:33 ` [PATCH v2 1/2] tty: Prevent writing chars during tcsetattr TCSADRAIN/FLUSH Ilpo Järvinen
  2023-03-17 11:33 ` [PATCH v2 2/2] serial: 8250: Fix serial8250_tx_empty() race with DMA Tx Ilpo Järvinen
  0 siblings, 2 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2023-03-17 11:33 UTC (permalink / raw)
  To: linux-serial, Greg Kroah-Hartman, Jiri Slaby, David Laight
  Cc: linux-kernel, Ilpo Järvinen

Fix two races related TCSADRAIN/FLUSH. One in tty core and the other
that can occur when 8250 UART is using DMA for Tx.

These might be slightly controversial as it requires userspace to race
write() with tcsetattr() to trigger these races. But since the races
still seem fixable on kernel side, I made these patches.

v2:
- Switch DMA Tx running / LSR Tx empty checks order due to fast/slowness
- Calculate the result in serial8250_tx_empty() directly

Ilpo Järvinen (2):
  tty: Prevent writing chars during tcsetattr TCSADRAIN/FLUSH
  serial: 8250: Fix serial8250_tx_empty() race with DMA Tx

 drivers/tty/serial/8250/8250.h      | 12 ++++++++
 drivers/tty/serial/8250/8250_port.c |  7 +++--
 drivers/tty/tty.h                   |  2 ++
 drivers/tty/tty_io.c                |  4 +--
 drivers/tty/tty_ioctl.c             | 45 +++++++++++++++++++++--------
 5 files changed, 53 insertions(+), 17 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-20  9:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17 11:33 [PATCH v2 0/2] tty/serial: Fix tcsetattr() TCSADRAIN/FLUSH and write() races Ilpo Järvinen
2023-03-17 11:33 ` [PATCH v2 1/2] tty: Prevent writing chars during tcsetattr TCSADRAIN/FLUSH Ilpo Järvinen
2023-03-17 11:33 ` [PATCH v2 2/2] serial: 8250: Fix serial8250_tx_empty() race with DMA Tx Ilpo Järvinen
2023-03-18 11:47   ` David Laight
2023-03-20  9:00     ` Ilpo Järvinen

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

all inboxes | Powered by JetHome®