linux-stable/drivers/tty
Uwe Kleine-König 3e843460fb serial: 8250: Fix race condition in RTS-after-send handling
[ Upstream commit dedab69fd6 ]

Set em485->active_timer = NULL isn't always enough to take out the stop
timer. While there is a check that it acts in the right state (i.e.
waiting for RTS-after-send to pass after sending some chars) but the
following might happen:

 - CPU1: some chars send, shifter becomes empty, stop tx timer armed
 - CPU0: more chars send before RTS-after-send expired
 - CPU0: shifter empty irq, port lock taken
 - CPU1: tx timer triggers, waits for port lock
 - CPU0: em485->active_timer = &em485->stop_tx_timer, hrtimer_start(),
   releases lock()
 - CPU1: get lock, see em485->active_timer == &em485->stop_tx_timer,
   tear down RTS too early

This fix bases on research done by Steffen Trumtrar.

Fixes: b86f86e8e7 ("serial: 8250: fix potential deadlock in rs485-mode")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220215160236.344236-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08 14:23:46 +02:00
..
hvc xen/console: harden hvc_xen against event channel storms 2021-12-22 09:32:52 +01:00
ipwireless tty: drop put_tty_driver 2021-07-27 12:17:21 +02:00
serdev TTY / Serial patches for 5.15-rc1 2021-09-01 09:51:16 -07:00
serial serial: 8250: Fix race condition in RTS-after-send handling 2022-04-08 14:23:46 +02:00
vt vt_ioctl: add array_index_nospec to VT_ACTIVATE 2022-02-16 12:56:33 +01:00
amiserial.c tty: drop put_tty_driver 2021-07-27 12:17:21 +02:00
ehv_bytechan.c tty: drop put_tty_driver 2021-07-27 12:17:21 +02:00
goldfish.c tty: drop put_tty_driver 2021-07-27 12:17:21 +02:00
Kconfig This pull request contains the following changes for UML: 2021-07-09 10:19:13 -07:00
Makefile
mips_ejtag_fdc.c tty: drop put_tty_driver 2021-07-27 12:17:21 +02:00
moxa.c tty: moxa: use semi-colons instead of commas 2021-08-26 14:48:07 +02:00
moxa.h
mxser.c mxser: fix xmit_buf leak in activate when LSR == 0xff 2022-04-08 14:23:43 +02:00
n_gsm.c tty: n_gsm: fix deadlock in gsmtty_open() 2022-03-02 11:48:09 +01:00
n_hdlc.c tty: n_hdlc: make n_hdlc_tty_wakeup() asynchronous 2021-12-22 09:32:45 +01:00
n_null.c
n_tty.c tty: n_tty: do not look ahead for EOL character past the end of the buffer 2022-02-23 12:03:15 +01:00
nozomi.c tty: drop put_tty_driver 2021-07-27 12:17:21 +02:00
pty.c
synclink_gt.c tty: synclink_gt: rename a conflicting function name 2021-09-14 10:51:37 +02:00
sysrq.c tty: replace in_irq() with in_hardirq() 2021-08-16 19:01:52 +02:00
tty.h
tty_audit.c
tty_baudrate.c
tty_buffer.c tty: tty_buffer: Fix the softlockup issue in flush_to_ldisc 2021-11-25 09:48:28 +01:00
tty_io.c tty: Fix data race between tiocsti() and flush_to_ldisc() 2021-08-26 14:51:38 +02:00
tty_ioctl.c
tty_jobctrl.c
tty_ldisc.c tty: unexport tty_ldisc_release 2021-09-14 11:18:47 +02:00
tty_ldsem.c
tty_mutex.c
tty_port.c
ttynull.c tty: drop put_tty_driver 2021-07-27 12:17:21 +02:00
vcc.c tty: drop put_tty_driver 2021-07-27 12:17:21 +02:00