1
0
Fork 0
alistair23-linux/drivers/uio
Jia-Ju Bai 750a95d637 uio: fix a sleep-in-atomic-context bug in uio_dmem_genirq_irqcontrol()
[ Upstream commit b74351287d ]

The driver may sleep while holding a spinlock.
The function call path (from bottom to top) in Linux 4.19 is:

kernel/irq/manage.c, 523:
	synchronize_irq in disable_irq
drivers/uio/uio_dmem_genirq.c, 140:
	disable_irq in uio_dmem_genirq_irqcontrol
drivers/uio/uio_dmem_genirq.c, 134:
	_raw_spin_lock_irqsave in uio_dmem_genirq_irqcontrol

synchronize_irq() can sleep at runtime.

To fix this bug, disable_irq() is called without holding the spinlock.

This bug is found by a static analysis tool STCheck written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20191218094405.6009-1-baijiaju1990@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-24 08:36:27 +01:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
uio.c driver: uio: fix possible use-after-free in __uio_register_device 2019-01-31 16:36:52 +01:00
uio_aec.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
uio_cif.c uio: add SPDX license tags 2018-07-21 15:41:20 +02:00
uio_dmem_genirq.c uio: fix a sleep-in-atomic-context bug in uio_dmem_genirq_irqcontrol() 2020-02-24 08:36:27 +01:00
uio_fsl_elbc_gpcm.c uio: uio_fsl_elbc_gpcm: convert platform driver to use dev_groups 2019-08-02 12:56:51 +02:00
uio_hv_generic.c uio_hv_generic: set callbacks on open 2018-12-11 14:23:17 +01:00
uio_mf624.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
uio_netx.c uio: add SPDX license tags 2018-07-21 15:41:20 +02:00
uio_pci_generic.c uio/uio_pci_generic: Disable bus-mastering on release 2019-01-31 16:22:51 +01:00
uio_pdrv_genirq.c uio: uio_pdrv_genirq: Make UIO name controllable via DT node property 2019-09-04 13:42:43 +02:00
uio_pruss.c uio: pruss: fix error handling in probe 2018-08-02 10:14:26 +02:00
uio_sercos3.c uio: add SPDX license tags 2018-07-21 15:41:20 +02:00