linux/drivers/clk/samsung
Jinjie Ruan a03c246d4e clk: samsung: Fix out-of-bound access of of_match_node()
Currently, there is no terminator entry for exynosautov920_cmu_of_match,
hence facing below KASAN warning,

	BUG: KASAN: global-out-of-bounds in of_match_node+0x120/0x13c
	Read of size 1 at addr ffffffe31cc9e628 by task swapper/0/1

	CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.11.0+ #334
	Hardware name: linux,dummy-virt (DT)
	Call trace:
	 dump_backtrace+0x94/0xec
	 show_stack+0x18/0x24
	 dump_stack_lvl+0x90/0xd0
	 print_report+0x1f4/0x5b4
	 kasan_report+0xc8/0x110
	 __asan_report_load1_noabort+0x20/0x2c
	 of_match_node+0x120/0x13c
	 of_match_device+0x70/0xb4
	 platform_match+0xa0/0x25c
	 __device_attach_driver+0x7c/0x2d4
	 bus_for_each_drv+0x100/0x188
	 __device_attach+0x174/0x364
	 device_initial_probe+0x14/0x20
	 bus_probe_device+0x128/0x158
	 device_add+0xb3c/0x10fc
	 of_device_add+0xdc/0x150
	 of_platform_device_create_pdata+0x120/0x20c
	 of_platform_bus_create+0x2bc/0x620
	 of_platform_populate+0x58/0x108
	 of_platform_default_populate_init+0x100/0x120
	 do_one_initcall+0x110/0x788
	 kernel_init_freeable+0x44c/0x61c
	 kernel_init+0x24/0x1e4
	 ret_from_fork+0x10/0x20

	The buggy address belongs to the variable:
	 exynosautov920_cmu_of_match+0xc8/0x2c80

Add a dummy terminator entry at the end to assist of_match_node() in
traversing up to the terminator entry without accessing an
out-of-boundary index.

Fixes: 485e13fe2f ("clk: samsung: add top clock support for ExynosAuto v920 SoC")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20240927102104.3268790-1-ruanjinjie@huawei.com
[krzk: drop trailing comma]
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
2024-09-30 13:10:11 +02:00
..
clk-cpu.c clk: samsung: Switch to use kmemdup_array() 2024-06-16 09:20:48 +02:00
clk-cpu.h clk: samsung: Add CPU clock support for Exynos850 2024-02-25 17:07:34 +01:00
clk-exynos4.c clk: samsung: fix getting Exynos4 fin_pll rate from external clocks 2024-07-23 11:29:23 -07:00
clk-exynos5-subcmu.c clk: Explicitly include correct DT includes 2023-07-19 13:13:16 -07:00
clk-exynos5-subcmu.h clk: samsung: Change signature of exynos5_subcmus_init() function 2019-08-08 13:53:42 -07:00
clk-exynos7.c clk: exynos7: Mark aclk_fsys1_200 as critical 2021-04-07 11:37:17 +02:00
clk-exynos850.c clk: samsung: exynos850: Add TMU clock 2024-07-31 16:16:57 +02:00
clk-exynos3250.c clk: samsung: Pass register layout type explicitly to CLK_CPU() 2024-02-25 16:58:03 +01:00
clk-exynos4412-isp.c clk: samsung: exynos4: do not define number of clocks in bindings 2023-08-15 07:48:51 +02:00
clk-exynos5250.c clk: samsung: Pass register layout type explicitly to CLK_CPU() 2024-02-25 16:58:03 +01:00
clk-exynos5260.c clk: samsung: exynos5260: do not define number of clocks in bindings 2023-08-15 07:49:12 +02:00
clk-exynos5260.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
clk-exynos5410.c clk: samsung: exynos5410: do not define number of clocks in bindings 2023-08-15 07:49:19 +02:00
clk-exynos5420.c clk: samsung: Pass register layout type explicitly to CLK_CPU() 2024-02-25 16:58:03 +01:00
clk-exynos5433.c clk: samsung: Pass register layout type explicitly to CLK_CPU() 2024-02-25 16:58:03 +01:00
clk-exynos7885.c clk: samsung: exynos7885: Add USB related clocks to CMU_FSYS 2024-08-21 13:20:08 +02:00
clk-exynos-arm64.c clk: samsung: Implement manual PLL control for ARM64 SoCs 2024-03-26 09:58:32 +01:00
clk-exynos-arm64.h clk: samsung: exynos5433: Extract PM support to common ARM64 layer 2023-03-07 08:38:54 +01:00
clk-exynos-audss.c clk: Switch back to struct platform_driver::remove() 2024-09-21 14:12:05 -07:00
clk-exynos-clkout.c clk: Switch back to struct platform_driver::remove() 2024-09-21 14:12:05 -07:00
clk-exynosautov9.c clk: samsung: exynosautov9: add dpum clock support 2024-08-11 14:30:29 +02:00
clk-exynosautov920.c clk: samsung: Fix out-of-bound access of of_match_node() 2024-09-30 13:10:11 +02:00
clk-fsd.c clk: Explicitly include correct DT includes 2023-07-19 13:13:16 -07:00
clk-gs101.c clk: samsung: gs101: mark gout_hsi2_ufs_embd_i_clk_unipro as critical 2024-07-01 10:15:30 +02:00
clk-pll.c clk: samsung: clk-pll: Add support for pll_531x 2024-08-23 09:21:28 +02:00
clk-pll.h clk: samsung: clk-pll: Add support for pll_531x 2024-08-23 09:21:28 +02:00
clk-s3c64xx.c clk: samsung: Set dev in samsung_clk_init() 2023-03-06 16:55:26 +01:00
clk-s5pv210-audss.c clk: samsung: s5pv210-audss: Make use of devm_platform_ioremap_resource() 2021-09-13 18:01:09 +02:00
clk-s5pv210.c clk: samsung: Set dev in samsung_clk_init() 2023-03-06 16:55:26 +01:00
clk.c clk: samsung: Don't register clkdev lookup for the fixed rate clocks 2024-05-14 14:12:11 -07:00
clk.h clk: samsung: gs101: propagate PERIC0 USI SPI clock rate 2024-04-22 09:13:43 +02:00
Kconfig clk: samsung: add CONFIG_OF dependency 2023-06-12 11:45:20 +02:00
Makefile clk: samsung: add top clock support for ExynosAuto v920 SoC 2024-08-23 09:21:35 +02:00