linux-stable/drivers/tty
Uwe Kleine-König 101aa46bd2 serial: imx: fix a race condition in receive path
The main irq handler function starts by first masking disabled
interrupts in the status register values to ensure to only handle
enabled interrupts. This is important as when the RX path in the
hardware is disabled reading the RX fifo results in an external abort.

This checking must be done under the port lock, otherwise the following
can happen:

     CPU1                            | CPU2
                                     |
     irq triggers as there are chars |
     in the RX fifo                  |
				     | grab port lock
     imx_uart_int finds RRDY enabled |
     and calls imx_uart_rxint which  |
     has to wait for port lock       |
                                     | disable RX (e.g. because we're
                                     | using RS485 with !RX_DURING_TX)
                                     |
                                     | release port lock
     read from RX fifo with RX       |
     disabled => exception           |

So take the port lock only once in imx_uart_int() instead of in the
functions called from there.

Reported-by: Andre Renaud <arenaud@designa-electronics.com>
Cc: stable@vger.kernel.org
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20200121071702.20150-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-22 10:22:31 +01:00
..
hvc TTY/Serial patches for 5.5-rc1 2019-12-03 14:09:14 -08:00
ipwireless
serdev Merge 5.5-rc6 into tty-next 2020-01-13 12:13:05 +01:00
serial serial: imx: fix a race condition in receive path 2020-01-22 10:22:31 +01:00
vt vt: Correct comment documenting do_take_over_console() 2020-01-14 16:00:54 +01:00
amiserial.c Remove every trace of SERIAL_MAGIC 2019-11-13 19:01:14 +08:00
cyclades.c
ehv_bytechan.c
goldfish.c
isicom.c
Kconfig tty: Fix Kconfig indentation, continued 2019-11-21 14:38:31 +01:00
Makefile
mips_ejtag_fdc.c
moxa.c
moxa.h
mxser.c
mxser.h
n_gsm.c Revert "tty:n_gsm.c: destroy port by tty_port_destroy()" 2019-11-04 17:48:16 +01:00
n_hdlc.c tty: n_hdlc: fix build on SPARC 2019-10-04 15:14:20 +02:00
n_null.c
n_r3964.c
n_tracerouter.c
n_tracesink.c
n_tracesink.h
n_tty.c
nozomi.c
pty.c
rocket.c tty: rocket: reduce stack usage 2019-11-04 17:42:28 +01:00
rocket.h
rocket_int.h
synclink.c
synclink_gt.c tty: synclink_gt: Adjust indentation in several functions 2020-01-14 14:38:01 +01:00
synclinkmp.c tty: synclinkmp: Adjust indentation in several functions 2020-01-14 14:38:01 +01:00
sysrq.c sysrq: Remove sysrq_handler_registered 2019-12-17 14:46:23 +01:00
tty_audit.c
tty_baudrate.c
tty_buffer.c
tty_io.c tty: drop useless variable initialisation in tty_kopen() 2019-12-17 14:42:45 +01:00
tty_ioctl.c
tty_jobctrl.c
tty_ldisc.c tty_ldisc: simplify tty_ldisc_autoload initialization 2019-10-04 15:11:25 +02:00
tty_ldsem.c locking/lockdep: Remove unused @nested argument from lock_release() 2019-10-09 12:46:10 +02:00
tty_mutex.c
tty_port.c tty: always relink the port 2019-12-30 19:34:44 +01:00
ttynull.c
vcc.c