linux-stable/arch
Nathan Chancellor 0a312ec66a ARM: davinci: da850-evm: Avoid NULL pointer dereference
commit 83a1cde5c7 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:23:29 +02:00
..
alpha
arc uaccess: fix type mismatch warnings from access_ok() 2022-04-08 14:40:35 +02:00
arm ARM: davinci: da850-evm: Avoid NULL pointer dereference 2022-04-20 09:23:29 +02:00
arm64 arm64: alternatives: mark patch_alternative() as noinstr 2022-04-20 09:23:22 +02:00
c6x
csky uaccess: fix type mismatch warnings from access_ok() 2022-04-08 14:40:35 +02:00
h8300
hexagon
ia64
m68k m68k: coldfire/device.c: only build for MCF_EDMA when h/w macros are defined 2022-04-08 14:40:09 +02:00
microblaze uaccess: fix nios2 and microblaze get_user_8() 2022-04-08 14:40:08 +02:00
mips MIPS: ingenic: correct unit node address 2022-04-13 21:01:00 +02:00
nds32
nios2 uaccess: fix type mismatch warnings from access_ok() 2022-04-08 14:40:35 +02:00
openrisc
parisc parisc: Fix patch code locking and flushing 2022-04-13 21:01:03 +02:00
powerpc powerpc: Fix virt_addr_valid() for 64-bit Book3E & 32-bit 2022-04-13 21:01:11 +02:00
riscv riscv module: remove (NOLOAD) 2022-04-08 14:40:42 +02:00
s390
sh
sparc uaccess: fix type mismatch warnings from access_ok() 2022-04-08 14:40:35 +02:00
um um: Fix uml_mconsole stop/go 2022-04-08 14:40:44 +02:00
x86 KVM: x86/mmu: Resolve nx_huge_pages when kvm.ko is loaded 2022-04-20 09:23:25 +02:00
xtensa xtensa: fix DTC warning unit_address_format 2022-04-13 21:01:00 +02:00
.gitignore
Kconfig