[PATCH 12/12] clk: samsung: fsd: Terminate PLL rate tables with sentinels

From: Lee Jones

Date: Fri Nov 27 2026 - 13:06:07 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, pll_shared0_rate_table,
pll_shared1_rate_table, pll_shared2_rate_table, pll_shared3_rate_table,
pll_mfc_rate_table, and pll_cam_csi_rate_table 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 6 PLL rate tables.

Fixes: 4f346005aaed ("clk: samsung: fsd: Add initial clock support")
Fixes: 75c50afaa0d9 ("clk: samsung: fsd: Add cmu_mfc block clock information")
Fixes: b826c3e4de1a ("clk: samsung: fsd: Add cam_csi block clock information")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/clk/samsung/clk-fsd.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/clk/samsung/clk-fsd.c b/drivers/clk/samsung/clk-fsd.c
index 0a0bf1d62a04..ded7bfa97234 100644
--- a/drivers/clk/samsung/clk-fsd.c
+++ b/drivers/clk/samsung/clk-fsd.c
@@ -155,18 +155,22 @@ static const unsigned long cmu_clk_regs[] __initconst = {

static const struct samsung_pll_rate_table pll_shared0_rate_table[] __initconst = {
PLL_35XX_RATE(24 * MHZ, 2000000000U, 250, 3, 0),
+ { /* sentinel */ }
};

static const struct samsung_pll_rate_table pll_shared1_rate_table[] __initconst = {
PLL_35XX_RATE(24 * MHZ, 2400000000U, 200, 2, 0),
+ { /* sentinel */ }
};

static const struct samsung_pll_rate_table pll_shared2_rate_table[] __initconst = {
PLL_35XX_RATE(24 * MHZ, 2400000000U, 200, 2, 0),
+ { /* sentinel */ }
};

static const struct samsung_pll_rate_table pll_shared3_rate_table[] __initconst = {
PLL_35XX_RATE(24 * MHZ, 1800000000U, 150, 2, 0),
+ { /* sentinel */ }
};

static const struct samsung_pll_clock cmu_pll_clks[] __initconst = {
@@ -1482,6 +1486,7 @@ static const unsigned long mfc_clk_regs[] __initconst = {

static const struct samsung_pll_rate_table pll_mfc_rate_table[] __initconst = {
PLL_35XX_RATE(24 * MHZ, 666000000U, 111, 4, 0),
+ { /* sentinel */ }
};

static const struct samsung_pll_clock mfc_pll_clks[] __initconst = {
@@ -1642,6 +1647,7 @@ static const unsigned long cam_csi_clk_regs[] __initconst = {

static const struct samsung_pll_rate_table pll_cam_csi_rate_table[] __initconst = {
PLL_35XX_RATE(24 * MHZ, 1066000000U, 533, 12, 0),
+ { /* sentinel */ }
};

static const struct samsung_pll_clock cam_csi_pll_clks[] __initconst = {
--
2.56.1.839.g22a8290db9-goog