linux/arch
Nathan Chancellor 0940795c68 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:34:20 +02:00
..
alpha rtc: Check return value from mc146818_get_time() 2022-04-13 20:59:14 +02:00
arc uaccess: fix type mismatch warnings from access_ok() 2022-04-08 14:24:01 +02:00
arm ARM: davinci: da850-evm: Avoid NULL pointer dereference 2022-04-20 09:34:20 +02:00
arm64 arm64: alternatives: mark patch_alternative() as noinstr 2022-04-20 09:34:16 +02:00
csky uaccess: fix type mismatch warnings from access_ok() 2022-04-08 14:24:01 +02:00
h8300 Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
hexagon uaccess: fix integer overflow on access_ok() 2022-03-28 09:58:45 +02:00
ia64 PCI/sysfs: Find shadow ROM before static attribute initialization 2022-02-01 17:27:05 +01:00
m68k m68k: coldfire/device.c: only build for MCF_EDMA when h/w macros are defined 2022-04-08 14:23:20 +02:00
microblaze uaccess: fix nios2 and microblaze get_user_8() 2022-04-08 14:23:18 +02:00
mips MIPS: ingenic: correct unit node address 2022-04-13 20:59:09 +02:00
nds32 nds32: fix access_ok() checks in get/put_user 2022-03-28 09:58:46 +02:00
nios2 uaccess: fix type mismatch warnings from access_ok() 2022-04-08 14:24:01 +02:00
openrisc openrisc: Add clone3 ABI wrapper 2022-01-27 11:04:10 +01:00
parisc parisc: Fix patch code locking and flushing 2022-04-13 20:59:14 +02:00
powerpc powerpc: Fix virt_addr_valid() for 64-bit Book3E & 32-bit 2022-04-13 20:59:28 +02:00
riscv riscv: Fixed misaligned memory access. Fixed pointer comparison. 2022-04-13 20:59:09 +02:00
s390 s390/extable: fix exception table sorting 2022-03-08 19:12:48 +01:00
sh Documentation, arch: Remove leftovers from CIFS_WEAK_PW_HASH 2022-01-27 11:05:21 +01:00
sparc uaccess: fix type mismatch warnings from access_ok() 2022-04-08 14:24:01 +02:00
um um: fix and optimize xor select template for CONFIG64 and timetravel mode 2022-04-13 20:58:59 +02:00
x86 x86/tsx: Disable TSX development mode at boot 2022-04-20 09:34:20 +02:00
xtensa xtensa: fix DTC warning unit_address_format 2022-04-13 20:59:09 +02:00
.gitignore
Kconfig stack: Constrain and fix stack offset randomization with Clang builds 2022-04-08 14:23:06 +02:00