[PATCH 07/10] clk: samsung: exynos5420: Terminate PLL rate tables with sentinels

From: Lee Jones

Date: Mon Nov 23 2026 - 11:50:13 EST


_samsung_clk_register_pll() sizes each PLL rate table by scanning until
it encounters an entry with .rate == 0, then copies the counted entries
into pll->rate_table. However, exynos5420_pll2550x_24mhz_tbl,
exynos5422_bpll_rate_table, exynos5420_epll_24mhz_tbl, and
exynos5420_vpll_24mhz_tbl all omit a terminating zero sentinel, causing
out-of-bounds reads into adjacent read-only data and populating
pll->rate_table with bogus entries.

Append a sentinel entry to each of the four PLL rate tables.

Fixes: ca5b40293822 ("clk: samsung: register exynos5420 apll/kpll configuration data")
Fixes: 9842452acd3d ("clk: samsung: exynos542x: Add EPLL rate table")
Fixes: 8b4a7acf7b30 ("clk: samsung: add BPLL rate table for Exynos 5422 SoC")
Fixes: b92981de92cb ("clk: samsung: exynos5420: Add VPLL rate table")
Closes: https://sashiko.dev/#/bug/linux-553831f9-0a7b-4e94-be60-222de60ca8c3
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/clk/samsung/clk-exynos5420.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c
index 400a5c59815c..35baeabf3ccb 100644
--- a/drivers/clk/samsung/clk-exynos5420.c
+++ b/drivers/clk/samsung/clk-exynos5420.c
@@ -1419,6 +1419,7 @@ static const struct samsung_pll_rate_table exynos5420_pll2550x_24mhz_tbl[] __ini
PLL_35XX_RATE(24 * MHZ, 400000000, 200, 3, 2),
PLL_35XX_RATE(24 * MHZ, 300000000, 200, 2, 3),
PLL_35XX_RATE(24 * MHZ, 200000000, 200, 3, 3),
+ { /* sentinel */ }
};

static const struct samsung_pll_rate_table exynos5422_bpll_rate_table[] = {
@@ -1430,6 +1431,7 @@ static const struct samsung_pll_rate_table exynos5422_bpll_rate_table[] = {
PLL_35XX_RATE(24 * MHZ, 275000000, 275, 3, 3),
PLL_35XX_RATE(24 * MHZ, 206000000, 206, 3, 3),
PLL_35XX_RATE(24 * MHZ, 165000000, 110, 2, 3),
+ { /* sentinel */ }
};

static const struct samsung_pll_rate_table exynos5420_epll_24mhz_tbl[] = {
@@ -1448,6 +1450,7 @@ static const struct samsung_pll_rate_table exynos5420_epll_24mhz_tbl[] = {
PLL_36XX_RATE(24 * MHZ, 49152000U, 197, 3, 5, -25690),
PLL_36XX_RATE(24 * MHZ, 45158401U, 90, 3, 4, 20762),
PLL_36XX_RATE(24 * MHZ, 32768001U, 131, 3, 5, 4719),
+ { /* sentinel */ }
};

static const struct samsung_pll_rate_table exynos5420_vpll_24mhz_tbl[] = {
@@ -1459,6 +1462,7 @@ static const struct samsung_pll_rate_table exynos5420_vpll_24mhz_tbl[] = {
PLL_35XX_RATE(24 * MHZ, 266000000U, 266, 3, 3),
PLL_35XX_RATE(24 * MHZ, 177000000U, 118, 2, 3),
PLL_35XX_RATE(24 * MHZ, 100000000U, 200, 3, 4),
+ { /* sentinel */ }
};

static struct samsung_pll_clock exynos5x_plls[nr_plls] __initdata = {
--
2.56.1.750.gf70dc682cf-goog