linux/drivers/mmc/host
Deren Wu a99d21cefd mmc: vub300: fix invalid response handling
We may get an empty response with zero length at the beginning of
the driver start and get following UBSAN error. Since there is no
content(SDRT_NONE) for the response, just return and skip the response
handling to avoid this problem.

Test pass : SDIO wifi throughput test with this patch

[  126.980684] UBSAN: array-index-out-of-bounds in drivers/mmc/host/vub300.c:1719:12
[  126.980709] index -1 is out of range for type 'u32 [4]'
[  126.980729] CPU: 4 PID: 9 Comm: kworker/u16:0 Tainted: G            E      6.3.0-rc4-mtk-local-202304272142 #1
[  126.980754] Hardware name: Intel(R) Client Systems NUC8i7BEH/NUC8BEB, BIOS BECFL357.86A.0081.2020.0504.1834 05/04/2020
[  126.980770] Workqueue: kvub300c vub300_cmndwork_thread [vub300]
[  126.980833] Call Trace:
[  126.980845]  <TASK>
[  126.980860]  dump_stack_lvl+0x48/0x70
[  126.980895]  dump_stack+0x10/0x20
[  126.980916]  ubsan_epilogue+0x9/0x40
[  126.980944]  __ubsan_handle_out_of_bounds+0x70/0x90
[  126.980979]  vub300_cmndwork_thread+0x58e7/0x5e10 [vub300]
[  126.981018]  ? _raw_spin_unlock+0x18/0x40
[  126.981042]  ? finish_task_switch+0x175/0x6f0
[  126.981070]  ? __switch_to+0x42e/0xda0
[  126.981089]  ? __switch_to_asm+0x3a/0x80
[  126.981129]  ? __pfx_vub300_cmndwork_thread+0x10/0x10 [vub300]
[  126.981174]  ? __kasan_check_read+0x11/0x20
[  126.981204]  process_one_work+0x7ee/0x13d0
[  126.981246]  worker_thread+0x53c/0x1240
[  126.981291]  kthread+0x2b8/0x370
[  126.981312]  ? __pfx_worker_thread+0x10/0x10
[  126.981336]  ? __pfx_kthread+0x10/0x10
[  126.981359]  ret_from_fork+0x29/0x50
[  126.981400]  </TASK>

Fixes: 88095e7b47 ("mmc: Add new VUB300 USB-to-SD/SDIO/MMC driver")
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/048cd6972c50c33c2e8f81d5228fed928519918b.1683987673.git.deren.wu@mediatek.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2023-05-24 14:30:51 +02:00
..
alcor.c mmc: alcor: fix return value check of mmc_add_host() 2022-12-07 13:22:34 +01:00
atmel-mci.c mmc: atmel-mci: fix race between stop command and start of next command 2023-01-27 11:35:17 +01:00
au1xmmc.c mmc: au1xmmc: Replace kmap_atomic() with kmap_local_page() 2022-12-07 13:22:33 +01:00
bcm2835.c mmc: bcm2835: Replace kmap_atomic() with kmap_local_page() 2022-12-07 13:22:32 +01:00
cavium-octeon.c mmc: cavium-octeon: Add of_node_put() when breaking out of loop 2022-07-21 18:02:55 +02:00
cavium-thunderx.c mmc: cavium-thunderx: Add of_node_put() when breaking out of loop 2022-07-21 18:03:08 +02:00
cavium.c
cavium.h
cb710-mmc.c
cb710-mmc.h
cqhci-core.c mmc: cqhci: Capture eMMC and SD card errors 2022-07-12 12:25:35 +02:00
cqhci-crypto.c blk-crypto: rename blk_keyslot_manager to blk_crypto_profile 2021-10-21 10:49:32 -06:00
cqhci-crypto.h
cqhci.h
davinci_mmc.c mmc: davinci_mmc: Handle error for clk_enable 2022-03-15 10:29:53 +01:00
dw_mmc-bluefield.c
dw_mmc-exynos.c mmc: dw_mmc: exynos: Obviously always return success in remove callback 2022-07-12 12:25:37 +02:00
dw_mmc-exynos.h
dw_mmc-hi3798cv200.c mmc: dw_mmc: hi3789cv200: Obviously always return success in remove callback 2022-07-12 12:25:37 +02:00
dw_mmc-k3.c
dw_mmc-pci.c
dw_mmc-pltfm.c mmc: dw_mmc-pltfm: Use devm_platform_get_and_ioremap_resource() 2023-03-23 11:54:13 +01:00
dw_mmc-pltfm.h
dw_mmc-rockchip.c mmc: dw_mmc: rockchip: Obviously always return success in remove callback 2022-07-12 12:25:38 +02:00
dw_mmc-starfive.c mmc: dw_mmc-starfive: Fix initialization of prev_err 2023-03-09 15:33:51 +01:00
dw_mmc.c MMC core: 2022-12-13 13:41:26 -08:00
dw_mmc.h mmc: dw_mmc: Support setting f_min from host drivers 2022-03-07 12:56:38 +01:00
jz4740_mmc.c mmc: jz4740: Use devm_platform_get_and_ioremap_resource() 2023-03-23 11:54:35 +01:00
Kconfig mmc: sdhci-cadence: Add AMD Pensando Elba SoC support 2023-04-17 11:45:43 +02:00
litex_mmc.c mmc: litex_mmc: ensure host->irq == 0 if polling 2022-12-07 13:22:35 +01:00
Makefile MMC core: 2023-02-27 09:47:26 -08:00
meson-gx-mmc.c mmc: meson-gx: use new helpers mmc_regulator_enable/disable_vqmmc 2023-03-23 11:38:34 +01:00
meson-mx-sdhc-clkc.c mmc: meson-mx-sdhc: Drop unused MESON_SDHC_NUM_BUILTIN_CLKS macro 2021-12-20 11:19:01 +01:00
meson-mx-sdhc-mmc.c mmc: meson-mx-sdhc: Fix error check for dma_map_sg 2022-09-14 11:53:47 +02:00
meson-mx-sdhc.h
meson-mx-sdio.c mmc: meson-mx-sdio: add IRQ check 2021-12-21 13:22:34 +01:00
mmc_hsq.c mmc: mmc-hsq: Use fifo to dispatch mmc_request 2022-12-07 13:29:14 +01:00
mmc_hsq.h mmc: mmc-hsq: Use fifo to dispatch mmc_request 2022-12-07 13:29:14 +01:00
mmc_spi.c mmc: mmc_spi: fix error handling in mmc_spi_probe() 2023-02-14 00:09:17 +01:00
mmci_qcom_dml.c
mmci_stm32_sdmmc.c mmc: mmci: stm32: use a buffer for unaligned DMA requests 2022-04-26 14:05:18 +02:00
mmci.c mmc: Use of_property_read_bool() for boolean properties 2023-03-23 11:30:20 +01:00
mmci.h
moxart-mmc.c mmc: moxart: set maximum request/block/segment sizes 2023-02-15 13:24:03 +01:00
mtk-sd.c mmc: Avoid open coding by using mmc_op_tuning() 2022-12-07 13:29:13 +01:00
mvsdio.c
mvsdio.h
mxcmmc.c mmc: mxcmmc: fix return value check of mmc_add_host() 2022-12-07 13:22:34 +01:00
mxs-mmc.c mmc: mxs-mmc: disable regulator on error and in the remove function 2021-10-19 13:02:58 +02:00
of_mmc_spi.c mmc: mmc_spi: parse speed mode options 2022-04-26 14:05:19 +02:00
omap_hsmmc.c mmc: Use of_property_read_bool() for boolean properties 2023-03-23 11:30:20 +01:00
omap.c mmc: omap: Use devm_platform_get_and_ioremap_resource() 2023-03-23 11:55:13 +01:00
owl-mmc.c mmc: owl-mmc: Use devm_platform_get_and_ioremap_resource() 2023-03-23 11:56:06 +01:00
pxamci.c mmc: pxamci: fix return value check of mmc_add_host() 2022-12-07 13:22:34 +01:00
pxamci.h
renesas_sdhi_core.c mmc: renesas_sdhi: use new convenience macro from MMC core 2022-12-07 13:22:37 +01:00
renesas_sdhi_internal_dmac.c mmc: renesas_sdhi: remove R-Car H3 ES1.* handling 2023-03-23 11:30:20 +01:00
renesas_sdhi_sys_dmac.c mmc: tmio: remove 'alignment_shift' from platform data 2022-12-07 13:22:37 +01:00
renesas_sdhi.h mmc: renesas_sdhi: use plain numbers for end_flags 2022-12-07 13:28:22 +01:00
rtsx_pci_sdmmc.c mmc: rtsx_pci: fix return value check of mmc_add_host() 2022-12-07 13:22:34 +01:00
rtsx_usb_sdmmc.c mmc: rtsx_usb_sdmmc: fix return value check of mmc_add_host() 2022-12-07 13:22:34 +01:00
sdhci_am654.c mmc: sdhci_am654: Add support for PM suspend/resume 2023-04-04 13:50:08 +02:00
sdhci_f_sdh30.c mmc: f-sdh30: Add quirks for broken timeout clock capability 2022-12-07 13:22:36 +01:00
sdhci_f_sdh30.h mmc: f-sdh30: Add support for non-removable media 2022-12-07 13:22:36 +01:00
sdhci-acpi.c mmc: Remove duplicate words in comments 2022-12-07 13:22:34 +01:00
sdhci-bcm-kona.c mmc: Remove duplicate words in comments 2022-12-07 13:22:34 +01:00
sdhci-brcmstb.c mmc: sdhci-brcmstb: Use devm_platform_get_and_ioremap_resource() 2023-02-15 13:24:03 +01:00
sdhci-cadence.c mmc: sdhci-cadence: Fix an error handling path in sdhci_cdns_probe() 2023-05-09 11:16:15 +02:00
sdhci-cqhci.h mmc: cqhci: Provide helper for resetting both SDHCI and CQHCI 2022-11-07 13:28:47 +01:00
sdhci-dove.c
sdhci-esdhc-imx.c mmc: sdhci-esdhc-imx: make "no-mmc-hs400" works 2023-05-09 11:55:02 +02:00
sdhci-esdhc-mcf.c
sdhci-esdhc.h
sdhci-iproc.c mmc: sdhci-iproc: Replace SDHCI_QUIRK_MISSING_CAPS 2023-01-23 15:51:38 +01:00
sdhci-milbeaut.c
sdhci-msm.c firmware: qcom_scm: Move qcom_scm.h to include/linux/firmware/qcom/ 2023-02-08 19:15:16 -08:00
sdhci-of-arasan.c mmc: sdhci-of-arasan: Skip setting clock delay for 400KHz 2023-04-17 09:46:53 +02:00
sdhci-of-aspeed-test.c mmc: sdhci-of-aspeed: test: Use kunit_test_suite() macro 2022-07-11 17:13:32 -06:00
sdhci-of-aspeed.c mmc: sdhci-of-aspeed: Use devm_platform_get_and_ioremap_resource() 2023-03-23 11:56:41 +01:00
sdhci-of-at91.c mmc: sdhci-of-at91: fix set_uhs_signaling rewriting of MC1R 2022-07-12 12:42:37 +02:00
sdhci-of-dwcmshc.c mmc: sdhci-of-dwcmshc: properly determine max clock on Rockchip 2023-03-23 11:30:20 +01:00
sdhci-of-esdhc.c mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data 2023-03-24 16:48:01 +01:00
sdhci-of-hlwd.c
sdhci-of-sparx5.c
sdhci-omap.c mmc: Remove duplicate words in comments 2022-12-07 13:22:34 +01:00
sdhci-pci-arasan.c
sdhci-pci-core.c mmc: sdhci-pci: Replace SDHCI_QUIRK_MISSING_CAPS for Ricoh controller 2023-01-23 15:51:38 +01:00
sdhci-pci-dwc-mshc.c
sdhci-pci-gli.c mmc: sdhci-*: Convert drivers to new sdhci_and_cqhci_reset() 2022-12-07 13:22:33 +01:00
sdhci-pci-o2micro.c mmc: sdhci-pci-o2micro: Fix SDR50 mode timing issue 2023-03-23 11:30:20 +01:00
sdhci-pci.h mmc: sdhci-pci: Add PCI ID for Intel ADL 2021-12-14 21:35:25 +01:00
sdhci-pic32.c
sdhci-pltfm.c mmc: sdhci: drop useless sdhci_get_compatibility() !OF stub 2023-03-23 11:48:57 +01:00
sdhci-pltfm.h
sdhci-pxav2.c mmc: Use of_property_read_bool() for boolean properties 2023-03-23 11:30:20 +01:00
sdhci-pxav3.c mmc: sdhci-pxav3: Replace SDHCI_QUIRK_MISSING_CAPS 2023-01-23 15:51:38 +01:00
sdhci-s3c.c mmc: Use of_property_read_bool() for boolean properties 2023-03-23 11:30:20 +01:00
sdhci-spear.c
sdhci-sprd.c mmc: sdhci-sprd: Replace SDHCI_QUIRK_MISSING_CAPS 2023-01-23 15:51:38 +01:00
sdhci-st.c mmc: sdhci-st: Obviously always return success in remove callback 2022-07-12 12:25:38 +02:00
sdhci-tegra.c mmc: sdhci-tegra: Issue CMD and DAT resets together 2022-12-07 13:30:25 +01:00
sdhci-xenon-phy.c
sdhci-xenon.c Revert "mmc: sdhci-xenon: fix annoying 1.8V regulator warning" 2022-04-04 12:17:46 +02:00
sdhci-xenon.h
sdhci.c mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS 2023-01-23 15:51:38 +01:00
sdhci.h mmc: sdhci: Remove SDHCI_QUIRK_MISSING_CAPS 2023-01-23 15:51:38 +01:00
sdricoh_cs.c mmc: sdricoh_cs: remove unused sdricoh_readw function 2023-03-24 16:48:01 +01:00
sh_mmcif.c mmc: sh_mmcif: move platform_data header to proper location 2022-04-26 14:05:21 +02:00
sunplus-mmc.c mmc: Remove unneeded semicolon 2022-12-07 13:29:13 +01:00
sunxi-mmc.c mmc: sunxi-mmc: Fix clock refcount imbalance during unbind 2023-01-02 15:57:36 +01:00
tifm_sd.c mmc: tifm_sd: Replace kmap_atomic() with kmap_local_page() 2022-12-07 13:22:32 +01:00
tmio_mmc_core.c mmc: Use of_property_read_bool() for boolean properties 2023-03-23 11:30:20 +01:00
tmio_mmc.h mmc: tmio: remove tmio_mmc_k(un)map_atomic helpers 2022-12-07 13:22:36 +01:00
toshsd.c mmc: toshsd: fix return value check of mmc_add_host() 2022-12-07 13:22:34 +01:00
toshsd.h
uniphier-sd.c mmc: uniphier-sd: Add control to switch UHS speed 2023-01-27 11:55:50 +01:00
usdhi6rol0.c mmc: usdhi6rol0: Use devm_platform_get_and_ioremap_resource() 2023-03-23 11:57:04 +01:00
ushc.c
via-sdmmc.c mmc: via-sdmmc: fix return value check of mmc_add_host() 2022-12-07 13:22:35 +01:00
vub300.c mmc: vub300: fix invalid response handling 2023-05-24 14:30:51 +02:00
wbsd.c mmc: wbsd: fix return value check of mmc_add_host() 2022-12-07 13:22:35 +01:00
wbsd.h
wmt-sdmmc.c mmc: Use of_property_read_bool() for boolean properties 2023-03-23 11:30:20 +01:00