mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:38:03 +00:00
25f00a13dc
Add check for the return value of spi_get_csgpiod() to avoid passing a NULL
pointer to gpiod_direction_output(), preventing a crash when GPIO chip
select is not used.
Fix below crash:
[ 4.251960] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[ 4.260762] Mem abort info:
[ 4.263556] ESR = 0x0000000096000004
[ 4.267308] EC = 0x25: DABT (current EL), IL = 32 bits
[ 4.272624] SET = 0, FnV = 0
[ 4.275681] EA = 0, S1PTW = 0
[ 4.278822] FSC = 0x04: level 0 translation fault
[ 4.283704] Data abort info:
[ 4.286583] ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
[ 4.292074] CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[ 4.297130] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[ 4.302445] [0000000000000000] user address but active_mm is swapper
[ 4.308805] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
[ 4.315072] Modules linked in:
[ 4.318124] CPU: 2 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-rc4-next-20241023-00008-ga20ec42c5fc1 #359
[ 4.328130] Hardware name: LS1046A QDS Board (DT)
[ 4.332832] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 4.339794] pc : gpiod_direction_output+0x34/0x5c
[ 4.344505] lr : gpiod_direction_output+0x18/0x5c
[ 4.349208] sp : ffff80008003b8f0
[ 4.352517] x29: ffff80008003b8f0 x28: 0000000000000000 x27: ffffc96bcc7e9068
[ 4.359659] x26: ffffc96bcc6e00b0 x25: ffffc96bcc598398 x24: ffff447400132810
[ 4.366800] x23: 0000000000000000 x22: 0000000011e1a300 x21: 0000000000020002
[ 4.373940] x20: 0000000000000000 x19: 0000000000000000 x18: ffffffffffffffff
[ 4.381081] x17: ffff44740016e600 x16: 0000000500000003 x15: 0000000000000007
[ 4.388221] x14: 0000000000989680 x13: 0000000000020000 x12: 000000000000001e
[ 4.395362] x11: 0044b82fa09b5a53 x10: 0000000000000019 x9 : 0000000000000008
[ 4.402502] x8 : 0000000000000002 x7 : 0000000000000007 x6 : 0000000000000000
[ 4.409641] x5 : 0000000000000200 x4 : 0000000002000000 x3 : 0000000000000000
[ 4.416781] x2 : 0000000000022202 x1 : 0000000000000000 x0 : 0000000000000000
[ 4.423921] Call trace:
[ 4.426362] gpiod_direction_output+0x34/0x5c (P)
[ 4.431067] gpiod_direction_output+0x18/0x5c (L)
[ 4.435771] dspi_setup+0x220/0x334
Fixes:
|
||
---|---|---|
.. | ||
atmel-quadspi.c | ||
internals.h | ||
Kconfig | ||
Makefile | ||
spi-airoha-snfi.c | ||
spi-altera-core.c | ||
spi-altera-dfl.c | ||
spi-altera-platform.c | ||
spi-amd.c | ||
spi-amlogic-spifc-a1.c | ||
spi-ar934x.c | ||
spi-armada-3700.c | ||
spi-aspeed-smc.c | ||
spi-at91-usart.c | ||
spi-ath79.c | ||
spi-atmel.c | ||
spi-au1550.c | ||
spi-axi-spi-engine.c | ||
spi-bcm63xx-hsspi.c | ||
spi-bcm63xx.c | ||
spi-bcm2835.c | ||
spi-bcm2835aux.c | ||
spi-bcm-qspi.c | ||
spi-bcm-qspi.h | ||
spi-bcmbca-hsspi.c | ||
spi-bitbang-txrx.h | ||
spi-bitbang.c | ||
spi-brcmstb-qspi.c | ||
spi-butterfly.c | ||
spi-cadence-quadspi.c | ||
spi-cadence-xspi.c | ||
spi-cadence.c | ||
spi-cavium-octeon.c | ||
spi-cavium-thunderx.c | ||
spi-cavium.c | ||
spi-cavium.h | ||
spi-ch341.c | ||
spi-clps711x.c | ||
spi-coldfire-qspi.c | ||
spi-cs42l43.c | ||
spi-davinci.c | ||
spi-dln2.c | ||
spi-dw-bt1.c | ||
spi-dw-core.c | ||
spi-dw-dma.c | ||
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.h | ||
spi-fsl-dspi.c | ||
spi-fsl-espi.c | ||
spi-fsl-lib.c | ||
spi-fsl-lib.h | ||
spi-fsl-lpspi.c | ||
spi-fsl-qspi.c | ||
spi-fsl-spi.c | ||
spi-fsl-spi.h | ||
spi-geni-qcom.c | ||
spi-gpio.c | ||
spi-gxp.c | ||
spi-hisi-kunpeng.c | ||
spi-hisi-sfc-v3xx.c | ||
spi-img-spfi.c | ||
spi-imx.c | ||
spi-ingenic.c | ||
spi-intel-pci.c | ||
spi-intel-platform.c | ||
spi-intel.c | ||
spi-intel.h | ||
spi-iproc-qspi.c | ||
spi-jcore.c | ||
spi-lantiq-ssc.c | ||
spi-ljca.c | ||
spi-lm70llp.c | ||
spi-loongson-core.c | ||
spi-loongson-pci.c | ||
spi-loongson-plat.c | ||
spi-loongson.h | ||
spi-loopback-test.c | ||
spi-lp8841-rtc.c | ||
spi-mem.c | ||
spi-meson-spicc.c | ||
spi-meson-spifc.c | ||
spi-microchip-core-qspi.c | ||
spi-microchip-core.c | ||
spi-mpc52xx-psc.c | ||
spi-mpc52xx.c | ||
spi-mpc512x-psc.c | ||
spi-mt65xx.c | ||
spi-mt7621.c | ||
spi-mtk-nor.c | ||
spi-mtk-snfi.c | ||
spi-mux.c | ||
spi-mxic.c | ||
spi-mxs.c | ||
spi-npcm-fiu.c | ||
spi-npcm-pspi.c | ||
spi-nxp-fspi.c | ||
spi-oc-tiny.c | ||
spi-omap2-mcspi.c | ||
spi-omap-uwire.c | ||
spi-orion.c | ||
spi-pci1xxxx.c | ||
spi-pic32-sqi.c | ||
spi-pic32.c | ||
spi-pl022.c | ||
spi-ppc4xx.c | ||
spi-pxa2xx-dma.c | ||
spi-pxa2xx-pci.c | ||
spi-pxa2xx-platform.c | ||
spi-pxa2xx.c | ||
spi-pxa2xx.h | ||
spi-qcom-qspi.c | ||
spi-qup.c | ||
spi-rb4xx.c | ||
spi-realtek-rtl.c | ||
spi-rockchip-sfc.c | ||
spi-rockchip.c | ||
spi-rpc-if.c | ||
spi-rspi.c | ||
spi-rzv2m-csi.c | ||
spi-s3c64xx.c | ||
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-sn-f-ospi.c | ||
spi-sprd-adi.c | ||
spi-sprd.c | ||
spi-st-ssc4.c | ||
spi-stm32-qspi.c | ||
spi-stm32.c | ||
spi-sun4i.c | ||
spi-sun6i.c | ||
spi-sunplus-sp7021.c | ||
spi-synquacer.c | ||
spi-tegra20-sflash.c | ||
spi-tegra20-slink.c | ||
spi-tegra114.c | ||
spi-tegra210-quad.c | ||
spi-test.h | ||
spi-ti-qspi.c | ||
spi-tle62x0.c | ||
spi-topcliff-pch.c | ||
spi-uniphier.c | ||
spi-wpcm-fiu.c | ||
spi-xcomm.c | ||
spi-xilinx.c | ||
spi-xlp.c | ||
spi-xtensa-xtfpga.c | ||
spi-zynq-qspi.c | ||
spi-zynqmp-gqspi.c | ||
spi.c | ||
spidev.c |