kernel_samsung_a53x/arch/arm
Stefan Wahren a3512fcd40 ARM: sun9i: smp: Fix array-index-out-of-bounds read in sunxi_mc_smp_init
[ Upstream commit 72ad3b772b6d393701df58ba1359b0bb346a19ed ]

Running a multi-arch kernel (multi_v7_defconfig) on a Raspberry Pi 3B+
with enabled CONFIG_UBSAN triggers the following warning:

 UBSAN: array-index-out-of-bounds in arch/arm/mach-sunxi/mc_smp.c:810:29
 index 2 is out of range for type 'sunxi_mc_smp_data [2]'
 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.7.0-rc6-00248-g5254c0cbc92d
 Hardware name: BCM2835
  unwind_backtrace from show_stack+0x10/0x14
  show_stack from dump_stack_lvl+0x40/0x4c
  dump_stack_lvl from ubsan_epilogue+0x8/0x34
  ubsan_epilogue from __ubsan_handle_out_of_bounds+0x78/0x80
  __ubsan_handle_out_of_bounds from sunxi_mc_smp_init+0xe4/0x4cc
  sunxi_mc_smp_init from do_one_initcall+0xa0/0x2fc
  do_one_initcall from kernel_init_freeable+0xf4/0x2f4
  kernel_init_freeable from kernel_init+0x18/0x158
  kernel_init from ret_from_fork+0x14/0x28

Since the enabled method couldn't match with any entry from
sunxi_mc_smp_data, the value of the index shouldn't be used right after
the loop. So move it after the check of ret in order to have a valid
index.

Fixes: 1631090e34f5 ("ARM: sun9i: smp: Add is_a83t field")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://lore.kernel.org/r/20231228193903.9078-1-wahrenst@gmx.net
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-18 12:12:06 +01:00
..
boot ARM: dts: Fix occasional boot hang for am3 usb 2024-11-18 12:12:01 +01:00
common Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
configs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
crypto Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
include ARM: 9320/1: fix stack depot IRQ stack filter 2024-11-18 11:43:14 +01:00
kernel Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lib ARM: 9321/1: memset: cast the constant byte to unsigned char 2024-11-18 11:43:03 +01:00
mach-actions Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-alpine Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-artpec Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-asm9260 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-aspeed Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-at91 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-axxia Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-bcm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-berlin Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-clps711x Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-cns3xxx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-davinci Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-digicolor Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-dove Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-ebsa110 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-efm32 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-ep93xx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-exynos Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-footbridge Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-gemini Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-highbank Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-hisi Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-imx ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init 2024-11-18 12:11:41 +01:00
mach-integrator Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-iop32x Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-ixp4xx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-keystone Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-lpc18xx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-lpc32xx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-mediatek Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-meson Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-milbeaut Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-mmp Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-moxart Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-mstar Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-mv78xx0 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-mvebu Backport mac80211 patches from linux-6.1.y 2024-06-15 16:29:20 -03:00
mach-mxs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-nomadik Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-npcm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-nspire Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-omap1 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-omap2 ARM: OMAP2+: Fix null pointer dereference and memory leak in omap_soc_device_init 2024-11-18 12:11:58 +01:00
mach-orion5x Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-oxnas Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-picoxcell Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-prima2 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-pxa Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-qcom Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-rda Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-realtek Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-realview Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-rockchip Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-rpc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-s3c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-s5pv210 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-sa1100 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-shmobile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-socfpga Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-spear Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-sti Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-stm32 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-sunxi ARM: sun9i: smp: Fix array-index-out-of-bounds read in sunxi_mc_smp_init 2024-11-18 12:12:06 +01:00
mach-tango Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-tegra Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-u300 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-uniphier Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-ux500 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-versatile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-vexpress Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-vt8500 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-zx Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mach-zynq Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
net Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nwfpe Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
oprofile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
plat-omap Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
plat-orion Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
plat-pxa Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
plat-versatile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
probes Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tools Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vdso Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vfp Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xen arm/xen: fix xen_vcpu_info allocation alignment 2024-11-18 12:10:55 +01:00
Kbuild Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig-nommu Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig.assembler Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig.debug Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00