openwrt/target/linux/generic/pending-4.19
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
..
102-MIPS-only-process-negative-stack-offsets-on-stack-tr.patch
103-MIPS-perf-ath79-Fix-perfcount-IRQ-assignment.patch kernel: bump 4.19 to 4.19.51 2019-06-18 11:38:58 +02:00
110-ehci_hcd_ignore_oc.patch
120-Fix-alloc_node_mem_map-with-ARCH_PFN_OFFSET-calcu.patch kernel: bump 4.19 to 4.19.51 2019-06-18 11:38:58 +02:00
130-add-linux-spidev-compatible-si3210.patch
131-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch
132-spi-spi-gpio-fix-crash-when-num-chipselects-is-0.patch kernel: 4.19: fix crash when setting up spi-gpio 2019-09-19 11:53:18 +02:00
140-jffs2-use-.rename2-and-add-RENAME_WHITEOUT-support.patch
141-jffs2-add-RENAME_EXCHANGE-support.patch
150-bridge_allow_receiption_on_disabled_port.patch kernel: bump 4.19 to 4.19.62 2019-07-31 16:51:46 +02:00
180-net-phy-at803x-add-support-for-AT8032.patch
201-extra_optimization.patch kernel: bump 4.19 to 4.19.65 2019-08-09 18:30:33 +02:00
203-kallsyms_uncompressed.patch kernel: bump 4.19 to 4.19.64 2019-08-06 11:52:47 +02:00
205-backtrace_module_info.patch
220-optimize_inlining.patch kernel: bump 4.19 to 4.19.65 2019-08-09 18:30:33 +02:00
240-remove-unsane-filenames-from-deps_initramfs-list.patch
261-enable_wilink_platform_without_drivers.patch
300-mips_expose_boot_raw.patch kernel: bump 4.19 to 4.19.18 2019-01-28 18:17:32 +01:00
302-mips_no_branch_likely.patch kernel: bump 4.19 to 4.19.62 2019-07-31 16:51:46 +02:00
304-mips_disable_fpu.patch kernel: bump 4.19 to 4.19.62 2019-07-31 16:51:46 +02:00
305-mips_module_reloc.patch kernel: bump 4.19 to 4.19.62 2019-07-31 16:51:46 +02:00
306-mips_mem_functions_performance.patch
307-mips_highmem_offset.patch
308-mips32r2_tune.patch kernel: bump 4.19 to 4.19.62 2019-07-31 16:51:46 +02:00
309-MIPS-Add-CPU-option-reporting-to-proc-cpuinfo.patch kernel: MIPS: Add CPU option reporting to /proc/cpuinfo 2019-01-13 16:24:50 +01:00
310-arm_module_unresolved_weak_sym.patch
330-MIPS-kexec-Accept-command-line-parameters-from-users.patch
332-arc-add-OWRTDTB-section.patch kernel: bump 4.19 to 4.19.65 2019-08-09 18:30:33 +02:00
333-arc-enable-unaligned-access-in-kernel-mode.patch
341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch kernel: bump 4.19 to 4.19.18 2019-01-28 18:17:32 +01:00
342-powerpc-Enable-kernel-XZ-compression-option-on-PPC_8.patch kernel: bump 4.19 to 4.19.50 2019-06-12 15:04:09 +02:00
400-mtd-add-rootfs-split-support.patch kernel: bump 4.19 to 4.19.23 2019-02-15 21:53:27 +01:00
401-mtd-add-support-for-different-partition-parser-types.patch kernel: bump 4.19 to 4.19.23 2019-02-15 21:53:27 +01:00
402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch kernel: bump 4.19 to 4.19.23 2019-02-15 21:53:27 +01:00
403-mtd-hook-mtdsplit-to-Kbuild.patch
404-mtd-add-more-helper-functions.patch kernel: bump 4.19 to 4.19.23 2019-02-15 21:53:27 +01:00
411-mtd-partial_eraseblock_write.patch kernel: bump 4.19 to 4.19.23 2019-02-15 21:53:27 +01:00
412-mtd-partial_eraseblock_unlock.patch kernel: Remove deprecated generic linux,part-probe patch 2018-12-15 14:28:48 +01:00
419-mtd-redboot-add-of_match_table-with-DT-binding.patch
420-mtd-redboot_space.patch
430-mtd-add-myloader-partition-parser.patch
431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch
432-mtd-bcm47xxpart-detect-T_Meter-partition.patch
440-block2mtd_init.patch
441-block2mtd_probe.patch
450-mtd-spi-nor-allow-NOR-driver-to-write-fewer-bytes-th.patch kernel: refresh patches 2019-08-24 23:11:15 +02:00
460-mtd-cfi_cmdset_0002-no-erase_suspend.patch
461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch
465-m25p80-mx-disable-software-protection.patch kernel: refresh patches 2019-08-24 23:11:15 +02:00
466-Revert-mtd-spi-nor-fix-Spansion-regressions-aliased-.patch kernel: refresh patches 2019-08-24 23:11:15 +02:00
470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch kernel: refresh patches 2019-08-24 23:11:15 +02:00
475-mtd-spi-nor-Add-Winbond-w25q128jv-support.patch kernel: refresh patches 2019-08-24 23:11:15 +02:00
476-mtd-spi-nor-add-eon-en25q128.patch
477-mtd-add-spi-nor-add-mx25u3235f.patch
479-mtd-spi-nor-add-eon-en25qh64.patch kernel: mtd: add support for EN25QH64 in spi-nor.c 2019-01-02 22:12:19 +01:00
480-mtd-set-rootfs-to-be-root-dev.patch
490-ubi-auto-attach-mtd-device-named-ubi-or-data-on-boot.patch
491-ubi-auto-create-ubiblock-device-for-rootfs.patch
492-try-auto-mounting-ubi0-rootfs-in-init-do_mounts.c.patch
493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch
494-mtd-ubi-add-EOF-marker-support.patch
495-mtd-core-add-get_mtd_device_by_node.patch
496-dt-bindings-add-bindings-for-mtd-concat-devices.patch
497-mtd-mtdconcat-add-dt-driver-for-concat-devices.patch
530-jffs2_make_lzma_available.patch kernel: bump 4.19 to 4.19.46 2019-06-03 12:40:53 +02:00
532-jffs2_eofdetect.patch
553-ubifs-Add-option-to-create-UBI-FS-version-4-on-empty.patch
600-netfilter_conntrack_flush.patch
610-netfilter_match_bypass_default_checks.patch
611-netfilter_match_bypass_default_table.patch
612-netfilter_match_reduce_memory_access.patch
613-netfilter_optional_tcp_window_check.patch kernel: bump 4.19 to 4.19.67 2019-08-27 10:32:44 +02:00
616-net_optimize_xfrm_calls.patch
620-net_sched-codel-do-not-defer-queue-length-update.patch
630-packet_socket_type.patch kernel: bump 4.19 to 4.19.68 2019-08-28 13:08:20 +02:00
640-netfilter-nf_flow_table-add-hardware-offload-support.patch kernel: bump 4.19 to 4.19.72 2019-09-13 16:40:29 +02:00
641-netfilter-nf_flow_table-support-hw-offload-through-v.patch
642-net-8021q-support-hardware-flow-table-offload.patch kernel: bump 4.19 to 4.19.44 2019-05-21 09:45:15 +02:00
643-net-bridge-support-hardware-flow-table-offload.patch
644-net-pppoe-support-hardware-flow-table-offload.patch kernel: bump 4.19 to 4.19.19 2019-02-01 11:41:00 +01:00
645-netfilter-nf_flow_table-rework-hardware-offload-time.patch kernel: bump 4.19 to 4.19.51 2019-06-18 11:38:58 +02:00
646-netfilter-nf_flow_table-rework-private-driver-data.patch
655-increase_skb_pad.patch kernel: bump 4.19 to 4.19.46 2019-06-03 12:40:53 +02:00
666-Add-support-for-MAP-E-FMRs-mesh-mode.patch kernel: bump 4.19 to 4.19.66 2019-08-14 18:23:08 +02:00
670-ipv6-allow-rejecting-with-source-address-failed-policy.patch kernel: bump 4.19 to 4.19.48 2019-06-05 12:12:59 +02:00
671-net-provide-defines-for-_POLICY_FAILED-until-all-cod.patch
680-NET-skip-GRO-for-foreign-MAC-addresses.patch kernel: bump 4.19 to 4.19.37 2019-05-02 12:59:26 +02:00
681-NET-add-of_get_mac_address_mtd.patch
703-phy-add-detach-callback-to-struct-phy_driver.patch kernel: bump 4.19 to 4.19.62 2019-07-31 16:51:46 +02:00
734-net-phy-at803x-allow-to-configure-via-pdata.patch
735-net-phy-at803x-fix-at8033-sgmii-mode.patch
736-net-phy-at803x-allow-to-configure-via-dt.patch
800-bcma-get-SoC-device-struct-copy-its-DMA-params-to-th.patch kernel: bump 4.19 to 4.19.18 2019-01-28 18:17:32 +01:00
810-pci_disable_common_quirks.patch kernel: bump 4.19 to 4.19.46 2019-06-03 12:40:53 +02:00
811-pci_disable_usb_common_quirks.patch kernel: bump 4.19 to 4.19.64 2019-08-06 11:52:47 +02:00
834-ledtrig-libata.patch kernel: bump 4.19 to 4.19.53 2019-06-20 15:48:48 +02:00
840-media-i2c-tda1997x-select-V4L2_FWNODE.patch kernel: bump 4.19 to 4.19.34 2019-04-08 14:53:39 +02:00
920-mangle_bootargs.patch kernel: bump 4.19 to 4.19.48 2019-06-05 12:12:59 +02:00
0931-w1-gpio-fix-problem-with-platfom-data-in-w1-gpio.patch