openwrt/target/linux
DENG Qingfang 1979af10ca kernel: 4.19: fix crash when setting up spi-gpio
If an spi-gpio was specified with num-chipselects = <0> in dts, kernel
will crash:

 Unable to handle kernel paging request at virtual address 32697073
 pgd = (ptrval)
 [32697073] *pgd=00000000
 Internal error: Oops: 5 [# 1] SMP ARM
 Modules linked in:
 CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.19.72 #0
 Hardware name: Generic DT based system
 PC is at validate_desc+0x28/0x80
 LR is at gpiod_direction_output+0x14/0x128
 ...
 [<c0544db4>] (validate_desc) from [<c0545228>] (gpiod_direction_output+0x14/0x128)
 [<c0545228>] (gpiod_direction_output) from [<c05fa714>] (spi_gpio_setup+0x58/0x64)
 [<c05fa714>] (spi_gpio_setup) from [<c05f7258>] (spi_setup+0x12c/0x148)
 [<c05f7258>] (spi_setup) from [<c05f7330>] (spi_add_device+0xbc/0x12c)
 [<c05f7330>] (spi_add_device) from [<c05f7f74>] (spi_register_controller+0x838/0x924)
 [<c05f7f74>] (spi_register_controller) from [<c05fa494>] (spi_bitbang_start+0x108/0x120)
 [<c05fa494>] (spi_bitbang_start) from [<c05faa34>] (spi_gpio_probe+0x314/0x338)
 [<c05faa34>] (spi_gpio_probe) from [<c05a844c>] (platform_drv_probe+0x34/0x70)

The cause is spi_gpio_setup() did not check if the spi-gpio has
chipselect pins before setting their direction and results in derefing
an invalid pointer.

The bug is spotted in kernel 4.19.72 and does not occur in 4.14.

There is a similar fix upstream in kernel 5.2 in commit 249e2632dcd0
("spi: gpio: Don't request CS GPIO in DT use-case").

Ref: https://patchwork.kernel.org/patch/11150619/
Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
[use upstream patch, moved from hack to pending dir, commit facelift]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-09-19 11:53:18 +02:00
..
apm821xx apm821xx: image: remove unused kernel.dtb from IMAGES 2019-09-15 15:00:39 +00:00
ar7 kernel: bump 4.9 to 4.9.186 2019-07-31 16:51:46 +02:00
ar71xx ar71xx: fix typo in platform_do_upgrade_compex() 2019-09-16 07:00:22 +02:00
arc770 treewide: use wpad-basic for not small flash targets 2018-10-16 15:07:41 +01:00
archs38 treewide: use wpad-basic for not small flash targets 2018-10-16 15:07:41 +01:00
armvirt armvirt: fix overlay support by updating to f2fs/ext4 based overlays 2019-06-25 14:12:22 +00:00
at91 at91/image/sama5.mk: check for sama5d4_xplained device 2019-08-17 23:09:04 +02:00
ath25 treewide: sysupgrade: use $UPGRADE_BACKUP to check for backup 2019-09-11 09:05:35 +02:00
ath79 ath79: add support for TP-Link Archer C59v2 2019-09-16 21:40:06 +02:00
bcm53xx bcm53xx: sysupgrade: support Luxul firmware format 2019-09-16 16:01:42 +02:00
brcm47xx brcm47xx: sysupgrade: support Luxul firmware format 2019-09-16 21:37:33 +02:00
brcm63xx brcm63xx: remove redundant variable definition in Makefile 2019-09-14 11:43:19 +02:00
brcm2708 kernel: bump 4.19 to 4.19.71 2019-09-11 09:47:49 +02:00
cns3xxx treewide: sysupgrade: don't use $ARGV in platform_do_upgrade() 2019-07-17 08:05:38 +02:00
gemini kernel: bump 4.19 to 4.19.71 2019-09-11 09:47:49 +02:00
generic kernel: 4.19: fix crash when setting up spi-gpio 2019-09-19 11:53:18 +02:00
imx6 imx6: install-dtb as separate IMAGE 2019-09-15 15:00:17 +00:00
ipq40xx treewide: sysupgrade: use $UPGRADE_BACKUP to check for backup 2019-09-11 09:05:35 +02:00
ipq806x treewide: use new procd sysupgrade $UPGRADE_BACKUP variable 2019-09-05 23:33:19 +02:00
ixp4xx treewide: sysupgrade: use $UPGRADE_BACKUP to check for backup 2019-09-11 09:05:35 +02:00
kirkwood treewide: sync bootcount scripts across targets 2019-08-17 23:52:34 +08:00
lantiq lantiq: add device alias for Alpha ASL56026 2019-08-22 16:26:05 +02:00
layerscape kernel: bump 4.14 to 4.14.142 2019-09-11 09:47:49 +02:00
malta malta: fix overlay support by updating to f2fs/ext4 based overlays 2019-06-25 14:12:22 +00:00
mediatek mediatek: enable mtk_efuse by default 2019-09-15 22:56:09 +02:00
mpc85xx treewide: convert WiFi caldata size and offset to hexadecimal 2019-08-14 12:36:37 +02:00
mvebu treewide: use new procd sysupgrade $UPGRADE_BACKUP variable 2019-09-05 23:33:19 +02:00
mxs mxs: disable unused serial drivers 2019-03-11 19:35:43 +01:00
octeon treewide: use new procd sysupgrade $UPGRADE_BACKUP variable 2019-09-05 23:33:19 +02:00
octeontx kernel: Remove CONFIG_COMPAT 2019-05-11 17:15:41 +02:00
omap treewide: use new procd sysupgrade $UPGRADE_BACKUP variable 2019-09-05 23:33:19 +02:00
orion orion: sysupgrade: change platform_check_image() args validation 2019-07-16 13:58:26 +02:00
oxnas oxnas: convert DEVICE_TITLE to new variables 2019-07-10 16:56:16 +02:00
pistachio treewide: sysupgrade: get rid of platform_nand_pre_upgrade() 2019-07-22 14:27:37 +02:00
ramips ramips: add SD-Card support for Linkit Smart 7688 2019-09-15 20:34:09 +02:00
rb532 treewide: sysupgrade: get rid of platform_nand_pre_upgrade() 2019-07-22 14:27:37 +02:00
samsung samsung: split up DEVICE_TITLE 2019-09-11 15:17:09 +02:00
sunxi treewide: use new procd sysupgrade $UPGRADE_BACKUP variable 2019-09-05 23:33:19 +02:00
tegra treewide: use new procd sysupgrade $UPGRADE_BACKUP variable 2019-09-05 23:33:19 +02:00
uml kernel: Deactivate CONFIG_BINFMT_MISC 2019-05-11 17:15:41 +02:00
x86 treewide: use new procd sysupgrade $UPGRADE_BACKUP variable 2019-09-05 23:33:19 +02:00
zynq zynq: remove kernel 4.14 support 2019-08-17 16:57:32 +02:00
Makefile Add kernel_nconfig make target 2010-08-06 21:36:35 +00:00