1
0
Fork 0
freescale-linux-fslc/drivers/tty/serial
Johan Hovold 282c9eeda6 serial: stm32: fix threaded interrupt handling
[ Upstream commit e359b4411c ]

When DMA is enabled the receive handler runs in a threaded handler, but
the primary handler up until very recently neither disabled interrupts
in the device or used IRQF_ONESHOT. This would lead to a deadlock if an
interrupt comes in while the threaded receive handler is running under
the port lock.

Commit ad76768124 ("serial: stm32: fix a deadlock condition with
wakeup event") claimed to fix an unrelated deadlock, but unfortunately
also disabled interrupts in the threaded handler. While this prevents
the deadlock mentioned in the previous paragraph it also defeats the
purpose of using a threaded handler in the first place.

Fix this by making the interrupt one-shot and not disabling interrupts
in the threaded handler.

Note that (receive) DMA must not be used for a console port as the
threaded handler could be interrupted while holding the port lock,
something which could lead to a deadlock in case an interrupt handler
ends up calling printk.

Fixes: ad76768124 ("serial: stm32: fix a deadlock condition with wakeup event")
Fixes: 3489187204 ("serial: stm32: adding dma support")
Cc: stable@vger.kernel.org      # 4.9
Cc: Alexandre TORGUE <alexandre.torgue@st.com>
Cc: Gerald Baeza <gerald.baeza@st.com>
Reviewed-by: Valentin Caron<valentin.caron@foss.st.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210416140557.25177-3-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-06-10 13:39:22 +02:00
..
8250 serial: 8250_pci: handle FL_NOIRQ board flag 2021-06-03 09:00:34 +02:00
cpm_uart tty: serial: cpm_uart: Fix behaviour for non existing GPIOs 2020-06-27 13:50:51 +02:00
jsm tty: serial: Replace HTTP links with HTTPS ones 2020-07-21 20:04:54 +02:00
21285.c tty: serial: 21285: fix lockup on open 2020-10-28 13:39:14 +01:00
Kconfig tty: serial: imx: enable earlycon by default if IMX_SERIAL_CONSOLE is enabled 2020-11-06 17:23:49 +01:00
Makefile tty: serial: imx: add dependence and build for earlycon 2020-08-18 13:54:34 +02:00
altera_jtaguart.c serial: altera_jtaguart: Replace HTTP links with HTTPS ones 2020-07-21 20:04:54 +02:00
altera_uart.c
amba-pl010.c tty/serial: Migrate amba-pl01* to use has_sysrq 2019-12-18 15:04:44 +01:00
amba-pl011.c serial: pl011: Fix lockdep splat when handling magic-sysrq interrupt 2020-09-30 14:31:04 +02:00
amba-pl011.h
apbuart.c tty/serial: Migrate apbuart to use has_sysrq 2019-12-18 15:04:44 +01:00
apbuart.h
ar933x_uart.c serial: ar933x_uart: disable clk on error handling path in probe 2020-11-12 09:41:07 +01:00
arc_uart.c tty/serial: Migrate arc_uart to use has_sysrq 2019-12-18 15:04:45 +01:00
atmel_serial.c Linux 5.9-rc3 2020-08-31 07:19:25 +02:00
atmel_serial.h tty: serial: Use the correct style for SPDX License Identifier 2020-03-07 09:52:01 +01:00
bcm63xx_uart.c Revert "tty: serial: bcm63xx: fix missing clk_put() in bcm63xx_uart" 2020-05-04 11:49:57 +02:00
clps711x.c tty/serial: Migrate clps711x to use has_sysrq 2019-12-18 15:04:46 +01:00
digicolor-usart.c
dz.c TTY/Serial driver updates for 5.6-rc1 2020-01-29 10:13:27 -08:00
dz.h
earlycon-arm-semihost.c
earlycon-riscv-sbi.c
earlycon.c tty: serial: print earlycon info after match->setup 2020-09-16 13:16:20 +02:00
efm32-uart.c tty: serial: efm32: fix spelling mistake "reserverd" -> "reserved" 2020-02-19 11:38:58 +01:00
fsl_linflexuart.c tty/serial: Migrate fsl_linflexuart to use has_sysrq 2019-12-18 15:04:48 +01:00
fsl_lpuart.c tty: serial: fsl_lpuart: LS1021A has a FIFO size of 16 words, like LS1028A 2020-10-28 13:40:25 +01:00
icom.c tty: serial: icom: switch from 'pci_' to 'dma_' API 2020-09-04 18:07:20 +02:00
icom.h tty: serial: Use the correct style for SPDX License Identifier 2020-03-07 09:52:01 +01:00
ifx6x60.c tty: serial, fix kernel-doc 2020-08-18 13:51:18 +02:00
ifx6x60.h tty: serial: ifx6x60: Convert to GPIO descriptors 2020-03-12 10:03:54 +01:00
imx.c tty: serial: imx: keep console clocks always on 2020-11-12 09:39:53 +01:00
imx_earlycon.c tty: serial: imx: add imx earlycon driver 2020-07-29 17:11:02 +02:00
ip22zilog.c tty/serial: Migrate ip22zilog to use has_sysrq 2019-12-18 15:04:50 +01:00
ip22zilog.h
kgdb_nmi.c kdb: Switch to use safer dbg_io_ops over console APIs 2020-06-26 15:40:16 +01:00
kgdboc.c Linux 5.8-rc6 2020-07-20 09:39:11 +02:00
lantiq.c serial: lantiq: Make driver modular 2020-05-15 12:22:19 +02:00
lpc32xx_hs.c serial: lpc32xx_hs: Drop surplus include 2020-04-16 16:12:33 +02:00
max310x.c serial: max310x: unregister uart driver in case of failure and abort 2021-06-03 09:00:40 +02:00
max3100.c
mcf.c serial: mcf: add sysrq capability 2020-10-05 13:32:30 +02:00
men_z135_uart.c tty: serial, fix kernel-doc 2020-08-18 13:51:18 +02:00
meson_uart.c TTY/Serial driver updates for 5.6-rc1 2020-01-29 10:13:27 -08:00
milbeaut_usio.c tty/serial: Migrate milbeaut_usio to use has_sysrq 2019-12-18 15:04:51 +01:00
mpc52xx_uart.c tty/serial: mpc52xx_uart: Don't zero port->sysrq 2019-12-18 15:04:52 +01:00
mps2-uart.c
msm_serial.c serial: msm_serial: add sparse context annotation 2020-07-24 10:44:27 +02:00
mux.c TTY/Serial driver updates for 5.6-rc1 2020-01-29 10:13:27 -08:00
mvebu-uart.c Revert "serial: mvebu-uart: Fix to avoid a potential NULL pointer dereference" 2021-05-26 12:06:52 +02:00
mxs-auart.c serial: mxs-auart: add missed iounmap() in probe failure and remove 2020-07-10 14:44:46 +02:00
omap-serial.c serial: omap: fix rs485 half-duplex filtering 2021-05-14 09:50:21 +02:00
owl-uart.c tty: serial: owl: add "much needed" clk_prepare_enable() 2020-04-23 15:46:30 +02:00
pch_uart.c pch_uart: drop double zeroing 2020-09-27 14:17:43 +02:00
pic32_uart.c serial: pic32_uart: Use uart_console() helper 2020-03-12 10:00:22 +01:00
pic32_uart.h tty: serial: Use the correct style for SPDX License Identifier 2020-03-07 09:52:01 +01:00
pmac_zilog.c m68k: Fix WARNING splat in pmac_zilog driver 2020-12-30 11:54:11 +01:00
pmac_zilog.h
pnx8xxx_uart.c tty/serial: Migrate pnx8xxx_uart to use has_sysrq 2019-12-18 15:04:57 +01:00
pxa.c tty/serial: Migrate pxa to use has_sysrq 2019-12-18 15:04:57 +01:00
qcom_geni_serial.c soc: qcom-geni-se: Cleanup the code to remove proxy votes 2021-04-07 15:00:13 +02:00
rda-uart.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
rp2.c serial: rp2: use 'request_firmware' instead of 'request_firmware_nowait' 2021-06-03 09:00:34 +02:00
sa1100.c serial: sa1100: use platform_get_resource() 2020-08-18 15:02:06 +02:00
samsung_tty.c serial: samsung: Removes the IRQ not found warning 2020-08-18 13:53:42 +02:00
sb1250-duart.c MIPS: Replace SIBYTE_1956_WAR by CONFIG_SB1_PASS_2_WORKAROUNDS 2020-09-07 22:24:51 +02:00
sc16is7xx.c sc16is7xx: Defer probe if device read fails 2021-05-14 09:49:58 +02:00
sccnxp.c tty/serial: Migrate sccnxp to use has_sysrq 2019-12-18 15:05:00 +01:00
serial-tegra.c serial: tegra: Fix a mask operation that is always true 2021-06-03 09:00:34 +02:00
serial_core.c serial: core: fix suspicious security_locked_down() call 2021-06-03 09:00:32 +02:00
serial_mctrl_gpio.c serial: mctrl_gpio: Check for NULL pointer 2019-10-07 13:21:54 +02:00
serial_mctrl_gpio.h tty: serial: Use the correct style for SPDX License Identifier 2020-03-07 09:52:01 +01:00
serial_txx9.c serial: txx9: add missing platform_driver_unregister() on error in serial_txx9_init 2020-11-06 17:24:41 +01:00
sh-sci.c serial: sh-sci: Fix off-by-one error in FIFO threshold register setting 2021-06-03 09:00:34 +02:00
sh-sci.h serial: sh-sci: Drop unused include 2020-04-16 16:13:34 +02:00
sifive.c riscv: Fix sifive serial driver 2021-01-27 11:54:59 +01:00
sirfsoc_uart.c
sirfsoc_uart.h tty: serial: Use the correct style for SPDX License Identifier 2020-03-07 09:52:01 +01:00
sprd_serial.c serial: sprd: remove redundant sprd_port cleanup 2020-03-18 12:20:04 +01:00
st-asc.c tty: st-asc: switch to using devm_gpiod_get() 2020-01-10 14:01:33 +01:00
stm32-usart.c serial: stm32: fix threaded interrupt handling 2021-06-10 13:39:22 +02:00
stm32-usart.h serial: stm32: fix tx_empty condition 2021-05-14 09:50:08 +02:00
suncore.c
sunhv.c Revert "serial: sunhv: Initialize lock for non-registered console" 2020-07-21 18:21:49 +02:00
sunsab.c serial: sunsab: Return proper error code from console ->setup() hook 2020-06-25 14:21:28 +02:00
sunsab.h
sunsu.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
sunzilog.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
sunzilog.h
tegra-tcu.c
timbuart.c tty: timbuart: convert tasklets to use new tasklet_setup() API 2020-08-18 13:33:13 +02:00
timbuart.h tty: serial: Use the correct style for SPDX License Identifier 2020-03-07 09:52:01 +01:00
uartlite.c tty: serial: uartlite: Replace HTTP links with HTTPS ones 2020-07-21 20:04:54 +02:00
ucc_uart.c serial: ucc_uart: make qe_uart_set_mctrl() static 2020-09-16 13:14:58 +02:00
vr41xx_siu.c tty/serial: Migrate vr41xx_siu to use has_sysrq 2019-12-18 15:05:09 +01:00
vt8500_serial.c tty/serial: Migrate vt8500_serial to use has_sysrq 2019-12-18 15:05:09 +01:00
xilinx_uartps.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
zs.c TTY/Serial driver updates for 5.6-rc1 2020-01-29 10:13:27 -08:00
zs.h