WSL2-Linux-Kernel/drivers/spi
Jonas Gorski 217b6ea8cf spi: bcm-qspi: return error if neither hif_mspi nor mspi is available
[ Upstream commit 7c1f23ad34 ]

If neither a "hif_mspi" nor "mspi" resource is present, the driver will
just early exit in probe but still return success. Apart from not doing
anything meaningful, this would then also lead to a null pointer access
on removal, as platform_get_drvdata() would return NULL, which it would
then try to dereference when trying to unregister the spi master.

Fix this by unconditionally calling devm_ioremap_resource(), as it can
handle a NULL res and will then return a viable ERR_PTR() if we get one.

The "return 0;" was previously a "goto qspi_resource_err;" where then
ret was returned, but since ret was still initialized to 0 at this place
this was a valid conversion in 63c5395bb7 ("spi: bcm-qspi: Fix
use-after-free on unbind"). The issue was not introduced by this commit,
only made more obvious.

Fixes: fa236a7ef2 ("spi: bcm-qspi: Add Broadcom MSPI driver")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Kamal Dasu <kamal.dasu@broadcom.com>
Link: https://lore.kernel.org/r/20230629134306.95823-1-jonas.gorski@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-23 13:47:28 +02:00
..
Kconfig spi: dw_bt1: fix MUX_MMIO dependencies 2023-03-10 09:39:27 +01:00
Makefile
atmel-quadspi.c spi: atmel-quadspi: Fix the buswidth adjustment between spi-mem and controller 2022-04-27 14:39:02 +02:00
internals.h
spi-altera-core.c
spi-altera-dfl.c spi: spi-altera-dfl: Fix an error handling path 2022-08-17 14:23:06 +02:00
spi-altera-platform.c spi: altera: Change to dynamic allocation of spi id 2021-10-20 01:53:15 +01:00
spi-amd.c spi: amd: Limit max transfer and message size 2022-07-21 21:24:16 +02:00
spi-ar934x.c
spi-armada-3700.c spi: change clk_disable_unprepare to clk_unprepare 2021-12-29 12:28:39 +01:00
spi-at91-usart.c
spi-ath79.c
spi-atmel.c spi: atmel: Fix PDC transfer setup bug 2021-10-01 19:34:55 +01:00
spi-au1550.c
spi-axi-spi-engine.c
spi-bcm-qspi.c spi: bcm-qspi: return error if neither hif_mspi nor mspi is available 2023-07-23 13:47:28 +02:00
spi-bcm-qspi.h
spi-bcm63xx-hsspi.c spi: bcm63xx-hsspi: Fix multi-bit mode setting 2023-03-10 09:39:30 +01:00
spi-bcm63xx.c
spi-bcm2835.c spi: bcm2835: bcm2835_spi_handle_err(): fix NULL pointer deref for non DMA transfers 2022-07-29 17:25:24 +02:00
spi-bcm2835aux.c
spi-bitbang-txrx.h
spi-bitbang.c
spi-brcmstb-qspi.c
spi-butterfly.c
spi-cadence-quadspi.c spi: cadence-quadspi: fix suspend-resume implementations 2023-05-11 23:00:33 +09:00
spi-cadence.c
spi-cavium-octeon.c
spi-cavium-thunderx.c
spi-cavium.c
spi-cavium.h
spi-clps711x.c
spi-coldfire-qspi.c
spi-davinci.c
spi-dln2.c
spi-dw-bt1.c spi: dw: Fix PM disable depth imbalance in dw_spi_bt1_probe 2022-10-26 12:34:45 +02:00
spi-dw-core.c spi: dw: Round of n_bytes to power of 2 2023-07-23 13:46:50 +02:00
spi-dw-dma.c spi: dw-dma: decrease reference count in dw_spi_dma_init_mfld() 2022-12-02 17:41:03 +01:00
spi-dw-mmio.c
spi-dw-pci.c
spi-dw.h
spi-ep93xx.c
spi-falcon.c
spi-fsi.c
spi-fsl-cpm.c spi: fsl-cpm: Use 16 bit mode for large transfers with even size 2023-05-30 13:55:29 +01:00
spi-fsl-cpm.h
spi-fsl-dspi.c spi: fsl-dspi: avoid SCK glitches with continuous transfers 2023-06-21 15:59:16 +02:00
spi-fsl-espi.c
spi-fsl-lib.c
spi-fsl-lib.h
spi-fsl-lpspi.c spi: lpspi: disable lpspi module irq in DMA mode 2023-06-28 10:29:52 +02:00
spi-fsl-qspi.c spi: spi-fsl-qspi: check return value after calling platform_get_resource_byname() 2022-06-09 10:22:55 +02:00
spi-fsl-spi.c spi: fsl-cpm: Use 16 bit mode for large transfers with even size 2023-05-30 13:55:29 +01:00
spi-fsl-spi.h
spi-geni-qcom.c spi: spi-geni-qcom: Correct CS_TOGGLE bit in SPI_TRANS_CFG 2023-07-23 13:46:49 +02:00
spi-gpio.c spi: spi-gpio: Don't set MOSI as an input if not 3WIRE mode 2022-12-31 13:14:18 +01:00
spi-hisi-kunpeng.c spi: hisi-kunpeng: Fix the debugfs directory name incorrect 2022-01-27 11:03:12 +01:00
spi-hisi-sfc-v3xx.c
spi-img-spfi.c spi: img-spfi: Fix pm_runtime_get_sync() error checking 2022-06-09 10:22:48 +02:00
spi-imx.c spi: spi-imx: fix MX51_ECSPI_* macros when cs > 3 2023-05-24 17:36:46 +01:00
spi-iproc-qspi.c
spi-jcore.c
spi-lantiq-ssc.c
spi-lm70llp.c
spi-loopback-test.c
spi-lp8841-rtc.c
spi-mem.c
spi-meson-spicc.c spi: meson-spicc: do not rely on busy flag in pow2 clk ops 2022-10-26 12:34:42 +02:00
spi-meson-spifc.c spi: spi-meson-spifc: Add missing pm_runtime_disable() in meson_spifc_probe 2022-01-27 11:03:59 +01:00
spi-mpc52xx-psc.c
spi-mpc52xx.c
spi-mpc512x-psc.c
spi-mt65xx.c spi: mediatek: Fix DEVAPC Violation at KO Remove 2022-12-14 11:37:15 +01:00
spi-mt7621.c spi: mt7621: Fix an error message in mt7621_spi_probe() 2022-10-26 12:34:40 +02:00
spi-mtk-nor.c spi: spi-mtk-nor: initialize spi controller after resume 2022-04-27 14:38:52 +02:00
spi-mux.c spi-mux: Fix false-positive lockdep splats 2021-10-14 13:32:19 +01:00
spi-mxic.c spi: mxic: Fix the transmit path 2022-04-08 14:22:53 +02:00
spi-mxs.c
spi-npcm-fiu.c
spi-npcm-pspi.c
spi-nxp-fspi.c spi: spi-nxp-fspi: don't depend on a specific node name erratum workaround 2021-10-02 01:31:49 +01:00
spi-oc-tiny.c
spi-omap-100k.c spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe 2022-10-26 12:34:46 +02:00
spi-omap-uwire.c
spi-omap2-mcspi.c
spi-orion.c
spi-pic32-sqi.c
spi-pic32.c
spi-pl022.c spi: spl022: fix Microwire full duplex mode 2021-10-26 11:53:57 +01:00
spi-ppc4xx.c
spi-pxa2xx-dma.c
spi-pxa2xx-pci.c spi: pxa2xx-pci: Balance reference count for PCI DMA device 2022-04-08 14:23:07 +02:00
spi-pxa2xx.c
spi-pxa2xx.h
spi-qcom-qspi.c
spi-qup.c spi: qup: Request DMA before enabling clocks 2023-06-14 11:13:00 +02:00
spi-rb4xx.c
spi-realtek-rtl.c
spi-rockchip-sfc.c spi: spi-rockchip: Fix missing unwind goto in rockchip_sfc_probe() 2023-04-26 13:51:49 +02:00
spi-rockchip.c spi: rockchip: fix missing error on unsupported SPI_CS_HIGH 2022-06-09 10:22:50 +02:00
spi-rpc-if.c spi: spi-rpc-if: Check return value of rpcif_sw_init() 2021-11-18 19:16:42 +01:00
spi-rspi.c spi: spi-rspi: Fix PIO fallback on RZ platforms 2022-08-17 14:23:05 +02:00
spi-s3c24xx-regs.h
spi-s3c24xx.c
spi-s3c64xx.c spi: s3c64xx: Fix large transfers with DMA 2022-10-26 12:34:47 +02:00
spi-sc18is602.c
spi-sh-hspi.c
spi-sh-msiof.c
spi-sh-sci.c
spi-sh.c
spi-sifive.c
spi-slave-mt27xx.c
spi-slave-system-control.c
spi-slave-time.c
spi-sprd-adi.c
spi-sprd.c
spi-st-ssc4.c
spi-stm32-qspi.c spi: stm32-qspi: Fix wait_cmd timeout in APM mode 2022-06-09 10:22:36 +02:00
spi-stm32.c spi: stm32: fix stm32_spi_prepare_mbr() that halves spi clk for every run 2022-12-02 17:41:01 +01:00
spi-sun4i.c
spi-sun6i.c
spi-synquacer.c spi: synquacer: Fix timeout handling in synquacer_spi_transfer_one() 2023-03-10 09:39:31 +01:00
spi-tegra20-sflash.c
spi-tegra20-slink.c spi: tegra20-slink: fix UAF in tegra_slink_remove() 2022-08-17 14:23:12 +02:00
spi-tegra114.c spi: tegra114: Add missing IRQ check in tegra_spi_probe 2022-04-08 14:23:05 +02:00
spi-tegra210-quad.c spi: tegra210-quad: Fix missin IRQ check in tegra_qspi_probe 2022-04-08 14:23:06 +02:00
spi-test.h
spi-ti-qspi.c spi: spi-ti-qspi: Fix return value handling of wait_for_completion_timeout 2022-06-09 10:22:46 +02:00
spi-tle62x0.c
spi-topcliff-pch.c
spi-uniphier.c spi: uniphier: fix reference count leak in uniphier_spi_probe() 2022-02-08 18:34:08 +01:00
spi-xcomm.c
spi-xilinx.c
spi-xlp.c
spi-xtensa-xtfpga.c
spi-zynq-qspi.c spi: spi-zynq-qspi: Fix a NULL pointer dereference in zynq_qspi_exec_mem_op() 2022-03-02 11:48:01 +01:00
spi-zynqmp-gqspi.c spi: spi-zynqmp-gqspi: Handle error for dma_set_mask 2022-04-08 14:23:07 +02:00
spi.c spi: Ensure that sg_table won't be used after being freed 2022-10-26 12:34:48 +02:00
spidev.c spi: spidev: remove debug messages that access spidev->spi without locking 2023-02-01 08:27:18 +01:00