android_kernel_xiaomi_sm7250/arch/arm/mach-davinci
Nathan Chancellor c64e2ed5cc ARM: davinci: da850-evm: Avoid NULL pointer dereference
commit 83a1cde5c74bfb44b49cb2a940d044bb2380f4ea upstream.

With newer versions of GCC, there is a panic in da850_evm_config_emac()
when booting multi_v5_defconfig in QEMU under the palmetto-bmc machine:

Unable to handle kernel NULL pointer dereference at virtual address 00000020
pgd = (ptrval)
[00000020] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 5.15.0 #1
Hardware name: Generic DT based system
PC is at da850_evm_config_emac+0x1c/0x120
LR is at do_one_initcall+0x50/0x1e0

The emac_pdata pointer in soc_info is NULL because davinci_soc_info only
gets populated on davinci machines but da850_evm_config_emac() is called
on all machines via device_initcall().

Move the rmii_en assignment below the machine check so that it is only
dereferenced when running on a supported SoC.

Fixes: bae105879f ("davinci: DA850/OMAP-L138 EVM: implement autodetect of RMII PHY")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/YcS4xVWs6bQlQSPC@archlinux-ax161/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-20 09:12:50 +02:00
..
include/mach ARM: davinci: remove legacy clocks 2018-06-26 16:15:55 +05:30
asp.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
board-da830-evm.c ARM: davinci: da830-evm: use aemif platform driver 2018-07-10 15:39:27 +05:30
board-da850-evm.c ARM: davinci: da850-evm: Avoid NULL pointer dereference 2022-04-20 09:12:50 +02:00
board-dm355-evm.c ARM: davinci: dm355: add new clock init using common clock framework 2018-06-26 15:45:55 +05:30
board-dm355-leopard.c ARM: davinci: dm355: add new clock init using common clock framework 2018-06-26 15:45:55 +05:30
board-dm365-evm.c ARM: davinci: dm365-evm: use the ti-aemif soc driver 2018-07-10 15:39:27 +05:30
board-dm644x-evm.c ARM: davinci: dm644x-evm: use aemif platform driver 2018-07-10 15:39:27 +05:30
board-dm646x-evm.c ARM: davinci: dm646x-evm: use aemif platform driver 2018-07-10 15:39:27 +05:30
board-mityomapl138.c ARM: davinci: mityomapl138: use aemif platform driver 2018-07-10 15:39:27 +05:30
board-neuros-osd2.c ARM: davinci: dm644x: add new clock init using common clock framework 2018-06-26 15:47:58 +05:30
board-omapl138-hawk.c ARM: davinci: omapl138-hawk: add aemif & nand support 2018-07-10 15:39:27 +05:30
board-sffsdr.c ARM: davinci: dm644x: add new clock init using common clock framework 2018-06-26 15:47:58 +05:30
clock.h ARM: davinci: remove legacy clocks 2018-06-26 16:15:55 +05:30
common.c ARM: davinci: remove legacy clocks 2018-06-26 16:15:55 +05:30
cp_intc.c ARM: davinci: use IRQCHIP_DECLARE for cp_intc 2016-04-14 12:09:50 +05:30
cp_intc.h
cpuidle.c
cpuidle.h
da8xx-dt.c ARM: davinci: da8xx-dt: switch to device tree clocks 2018-06-26 16:20:03 +05:30
da830.c ARM: davinci: da830: Remove legacy clock init 2018-06-26 15:55:43 +05:30
da850.c ARM: davinci: da850: Remove legacy clock init 2018-06-26 15:56:31 +05:30
davinci.h ARM: davinci: switch to common clock framework 2018-06-26 15:54:43 +05:30
ddr2.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
devices-da8xx.c ARM: davinci: da8xx: define gpio interrupts as separate resources 2019-09-16 08:21:55 +02:00
devices.c ARM: davinci: remove legacy clocks 2018-06-26 16:15:55 +05:30
dm355.c ARM: davinci: dm355: define gpio interrupts as separate resources 2019-09-16 08:21:56 +02:00
dm365.c ARM: davinci: dm365: Fix McBSP dma_slave_map entry 2019-11-10 11:27:26 +01:00
dm644x.c ARM: davinci: dm644x: define gpio interrupts as separate resources 2019-09-16 08:21:56 +02:00
dm646x.c ARM: davinci: dm646x: define gpio interrupts as separate resources 2019-09-16 08:21:56 +02:00
irq.c
Kconfig ARM: davinci: add device tree support to timer 2018-06-26 16:18:10 +05:30
Makefile ARM: davinci: unduplicate aemif support 2018-07-10 15:39:27 +05:30
Makefile.boot License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mux.c
mux.h
pdata-quirks.c ARM: davinci: fix const warnings 2017-06-15 19:18:24 +05:30
pm_domain.c ARM: davinci: da8xx-dt: switch to device tree clocks 2018-06-26 16:20:03 +05:30
pm.c ARM: davinci: PM: Do not free useful resources in normal path in 'davinci_pm_init' 2017-05-17 15:25:18 +05:30
psc.h ARM: davinci: remove legacy clocks 2018-06-26 16:15:55 +05:30
serial.c
sleep.S ARM: davinci: fix sleep.S build error on ARMv4 2019-08-16 10:12:48 +02:00
sram.c
sram.h
time.c ARM: davinci: add device tree support to timer 2018-06-26 16:18:10 +05:30
usb-da8xx.c ARM: davinci: da8xx: Remove legacy USB and SATA clock init 2018-06-26 16:13:52 +05:30
usb.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00