linux-stable/drivers/mmc/host
Wolfram Sang c421a077bb mmc: tmio: avoid concurrent runs of mmc_request_done()
[ Upstream commit e8d1b41e69 ]

With the to-be-fixed commit, the reset_work handler cleared 'host->mrq'
outside of the spinlock protected critical section. That leaves a small
race window during execution of 'tmio_mmc_reset()' where the done_work
handler could grab a pointer to the now invalid 'host->mrq'. Both would
use it to call mmc_request_done() causing problems (see link below).

However, 'host->mrq' cannot simply be cleared earlier inside the
critical section. That would allow new mrqs to come in asynchronously
while the actual reset of the controller still needs to be done. So,
like 'tmio_mmc_set_ios()', an ERR_PTR is used to prevent new mrqs from
coming in but still avoiding concurrency between work handlers.

Reported-by: Dirk Behme <dirk.behme@de.bosch.com>
Closes: https://lore.kernel.org/all/20240220061356.3001761-1-dirk.behme@de.bosch.com/
Fixes: df3ef2d3c9 ("mmc: protect the tmio_mmc driver against a theoretical race")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Dirk Behme <dirk.behme@de.bosch.com>
Reviewed-by: Dirk Behme <dirk.behme@de.bosch.com>
Cc: stable@vger.kernel.org # 3.0+
Link: https://lore.kernel.org/r/20240305104423.3177-2-wsa+renesas@sang-engineering.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-13 12:50:05 +02:00
..
Kconfig mmc: sdhci_omap: Fix TI SoC dependencies 2024-01-25 14:33:36 -08:00
Makefile
android-goldfish.c
atmel-mci.c mmc: atmel-mci: fix race between stop command and start of next command 2023-03-22 13:27:11 +01:00
au1xmmc.c mmc: au1xmmc: Fix an error handling path in au1xmmc_probe() 2022-10-26 13:19:27 +02:00
bcm2835.c mmc: bcm2835: fix deferred probing 2023-08-30 16:31:46 +02:00
cavium-octeon.c mmc: cavium-octeon: Add of_node_put() when breaking out of loop 2022-08-25 11:15:17 +02:00
cavium-thunderx.c mmc: cavium-thunderx: Add of_node_put() when breaking out of loop 2022-08-25 11:15:18 +02:00
cavium.c mmc: cavium: Add the missing dma unmap when the dma has finished. 2019-08-16 10:12:39 +02:00
cavium.h
cb710-mmc.c
cb710-mmc.h
cqhci.c mmc: cqhci: Fix task clearing in CQE error recovery 2023-12-08 08:43:26 +01:00
cqhci.h
davinci_mmc.c mmc: davinci_mmc: Handle error for clk_enable 2022-04-15 14:14:47 +02:00
dw_mmc-bluefield.c
dw_mmc-exynos.c mmc: dw_mmc: exynos: fix the finding clock sample value 2021-11-02 18:26:44 +01:00
dw_mmc-exynos.h
dw_mmc-hi3798cv200.c
dw_mmc-k3.c
dw_mmc-pci.c
dw_mmc-pltfm.c
dw_mmc-pltfm.h
dw_mmc-rockchip.c
dw_mmc-zx.c
dw_mmc-zx.h
dw_mmc.c mmc: dw_mmc: Dont wait for DRTO on Write RSP error 2021-11-26 11:35:57 +01:00
dw_mmc.h
jz4740_mmc.c mmc: Remove dev_err() usage after platform_get_irq() 2023-08-30 16:31:46 +02:00
meson-gx-mmc.c mmc: meson-gx: Remove setting of CMD_CFG_ERROR 2023-11-28 16:46:34 +00:00
meson-mx-sdio.c mmc: meson-mx-sdio: add IRQ check 2022-01-27 09:04:20 +01:00
mmc_spi.c mmc: spi: Toggle SPI polarity, do not hardcode it 2020-02-11 04:33:59 -08:00
mmci.c mmc: mmci: fix return value check of mmc_add_host() 2023-01-18 11:30:16 +01:00
mmci.h mmc: mmci: expand startbiterr to irqmask and error check 2019-11-24 08:20:43 +01:00
mmci_qcom_dml.c
mmci_qcom_dml.h
moxart-mmc.c mmc: moxart: read scr register without changing byte order 2023-08-16 18:12:59 +02:00
mtk-sd.c mmc: mtk-sd: fix deferred probing 2023-06-28 10:15:29 +02:00
mvsdio.c mmc: mvsdio: fix deferred probing 2023-06-28 10:15:29 +02:00
mvsdio.h
mxcmmc.c mmc: Remove dev_err() usage after platform_get_irq() 2023-08-30 16:31:46 +02:00
mxs-mmc.c mmc: mxs-mmc: disable regulator on error and in the remove function 2021-11-26 11:36:10 +01:00
of_mmc_spi.c
omap.c mmc: omap: fix deferred probing 2023-06-28 10:15:29 +02:00
omap_hsmmc.c mmc: omap_hsmmc: fix deferred probing 2023-06-28 10:15:29 +02:00
pxamci.c mmc: pxamci: Fix an error handling path in pxamci_probe() 2022-08-25 11:15:34 +02:00
pxamci.h
renesas_sdhi.h
renesas_sdhi_core.c mmc: tmio: move tmio_mmc_set_clock() to platform hook 2023-08-30 16:31:46 +02:00
renesas_sdhi_internal_dmac.c mmc: renesas_sdhi_internal_dmac: Fix DMA buffer alignment from 8 to 128-bytes 2021-03-04 09:39:45 +01:00
renesas_sdhi_sys_dmac.c
rtsx_pci_sdmmc.c mmc: rtsx: add 74 Clocks in power on flow 2022-05-12 12:20:26 +02:00
rtsx_usb_sdmmc.c mmc: rtsx_usb_sdmmc: fix return value check of mmc_add_host() 2023-01-18 11:30:15 +01:00
s3cmci.c mmc: Remove dev_err() usage after platform_get_irq() 2023-08-30 16:31:46 +02:00
s3cmci.h
sdhci-acpi.c mmc: sdhci-acpi: fix deferred probing 2023-06-28 10:15:29 +02:00
sdhci-bcm-kona.c
sdhci-brcmstb.c mmc: sdhci-brcmstb: handle mmc_of_parse() errors during probe 2020-01-27 14:50:28 +01:00
sdhci-cadence.c
sdhci-cns3xxx.c
sdhci-dove.c
sdhci-esdhc-imx.c mmc: sdhci-esdhc-imx: clear the buffer_read_ready to reset standard tuning circuit 2021-11-02 18:26:45 +01:00
sdhci-esdhc.h
sdhci-iproc.c
sdhci-msm.c mmc: Remove dev_err() usage after platform_get_irq() 2023-08-30 16:31:46 +02:00
sdhci-of-arasan.c mmc: sdhci-of-arasan: Check return value of non-void funtions 2021-09-22 11:48:07 +02:00
sdhci-of-at91.c mmc: sdhci-of-at91: fix set_uhs_signaling rewriting of MC1R 2022-08-25 11:15:16 +02:00
sdhci-of-dwcmshc.c mmc: sdhci-of-dwcmshc: set SDHCI_QUIRK2_PRESET_VALUE_BROKEN 2021-03-11 14:05:02 +01:00
sdhci-of-esdhc.c mmc: sdhci-of-esdhc: Fix refcount leak in esdhc_signal_voltage_switch 2022-08-25 11:15:16 +02:00
sdhci-of-hlwd.c
sdhci-omap.c mmc: sdhci-omap: Fix NULL pointer exception if regulator is not configured 2021-11-26 11:36:09 +01:00
sdhci-pci-arasan.c
sdhci-pci-core.c mmc: sdhci-pci: Fix possible memory leak caused by missing pci_dev_put() 2022-11-25 17:40:27 +01:00
sdhci-pci-data.c
sdhci-pci-dwc-mshc.c
sdhci-pci-o2micro.c mmc: sdhci: sdhci-pci-o2micro: Check if controller supports 8-bit width 2019-07-31 07:27:01 +02:00
sdhci-pci.h mmc: sdhci-pci: Add support for Intel CML 2019-09-16 08:22:13 +02:00
sdhci-pic32.c
sdhci-pltfm.c mmc: Remove dev_err() usage after platform_get_irq() 2023-08-30 16:31:46 +02:00
sdhci-pltfm.h
sdhci-pxav2.c
sdhci-pxav3.c
sdhci-s3c.c mmc: Remove dev_err() usage after platform_get_irq() 2023-08-30 16:31:46 +02:00
sdhci-sirf.c
sdhci-spear.c
sdhci-st.c
sdhci-tegra.c mmc: sdhci-tegra: Fix busy detection by enabling MMC_CAP_NEED_RSP_BUSY 2020-04-02 15:28:10 +02:00
sdhci-xenon-phy.c
sdhci-xenon.c Revert "mmc: sdhci-xenon: fix annoying 1.8V regulator warning" 2022-04-15 14:15:05 +02:00
sdhci-xenon.h
sdhci.c treewide: Remove uninitialized_var() usage 2023-08-11 11:45:01 +02:00
sdhci.h mmc: sdhci: Fix voltage switch delay 2022-12-08 11:18:34 +01:00
sdhci_f_sdh30.c mmc: Remove dev_err() usage after platform_get_irq() 2023-08-30 16:31:46 +02:00
sdricoh_cs.c
sh_mmcif.c
sunxi-mmc.c mmc: sunxi: fix deferred probing 2023-08-30 16:31:46 +02:00
tifm_sd.c
tmio_mmc.c mmc: tmio: move tmio_mmc_set_clock() to platform hook 2023-08-30 16:31:46 +02:00
tmio_mmc.h mmc: tmio: move tmio_mmc_set_clock() to platform hook 2023-08-30 16:31:46 +02:00
tmio_mmc_core.c mmc: tmio: avoid concurrent runs of mmc_request_done() 2024-04-13 12:50:05 +02:00
toshsd.c mmc: toshsd: fix return value check of mmc_add_host() 2023-01-18 11:30:15 +01:00
toshsd.h
usdhi6rol0.c mmc: usdhi60rol0: fix deferred probing 2023-06-28 10:15:30 +02:00
ushc.c
via-sdmmc.c mmc: via-sdmmc: fix return value check of mmc_add_host() 2023-01-18 11:30:16 +01:00
vub300.c mmc: vub300: fix an error code 2023-11-28 16:46:34 +00:00
wbsd.c mmc: wbsd: fix double mmc_free_host() in wbsd_init() 2023-08-30 16:31:50 +02:00
wbsd.h
wmt-sdmmc.c mmc: wmt-sdmmc: remove an incorrect release_mem_region() call in the .remove function 2024-03-26 18:22:36 -04:00