All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Krzysztof Kozlowski <krzk@kernel.org>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Peter Griffin <peter.griffin@linaro.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>,
	Thomas Abraham <thomas.ab@samsung.com>,
	Chander Kashyap <k.chander@samsung.com>,
	Amit Daniel Kachhap <amit.daniel@samsung.com>,
	Tomasz Figa <t.figa@samsung.com>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Marian Mihailescu <mihailescu2m@gmail.com>,
	linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 07/10] clk: samsung: exynos5420: Terminate PLL rate tables with sentinels
Date: Mon, 23 Nov 2026 16:47:40 +0000	[thread overview]
Message-ID: <20261123164834.3330320-8-lee@kernel.org> (raw)
In-Reply-To: <20261123164834.3330320-1-lee@kernel.org>

_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@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 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


  parent reply	other threads:[~2026-11-23 16:49 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 16:47 [PATCH 00/10] clk: Assorted bug fixes across clock core and drivers Lee Jones
2026-11-23 16:47 ` Lee Jones
2026-11-23 16:47 ` [PATCH 01/10] clk: imx: imx8qxp-lpcg: Prevent stack overflow when parsing clocks Lee Jones
2026-11-23 17:25   ` Frank Li
2026-11-25  0:19   ` Peng Fan
2026-11-23 16:47 ` [PATCH 02/10] clk: lmk04832: Validate child reg index in lmk04832_probe() Lee Jones
2026-11-23 16:47 ` [PATCH 03/10] clk: tegra: bpmp: Bound num_parents by MRQ_CLK_MAX_PARENTS Lee Jones
2026-11-23 16:47 ` [PATCH 04/10] clk: composite: Initialise sub-hw pointers in determine_rate() Lee Jones
2026-11-23 16:47 ` [PATCH 05/10] clk: divider: Avoid division by zero in _div_round_closest() Lee Jones
2026-11-23 17:13   ` sashiko-bot
2026-11-24 17:36   ` Brian Masney
2026-11-26  8:25     ` Lee Jones
2026-11-23 16:47 ` [PATCH 06/10] clk: gpio: Reject gate clocks with multiple parents Lee Jones
2026-11-23 16:47 ` Lee Jones [this message]
2026-11-23 17:26   ` [PATCH 07/10] clk: samsung: exynos5420: Terminate PLL rate tables with sentinels Krzysztof Kozlowski
2026-11-24 13:14     ` Lee Jones
2026-11-25 20:59   ` Peter Griffin
2026-11-26  7:09   ` Krzysztof Kozlowski
2026-11-26  7:11     ` Krzysztof Kozlowski
2026-11-23 16:47 ` [PATCH 08/10] clk: tenstorrent: Poll atomically in atlantis_clk_pll_enable() Lee Jones
2026-11-23 16:47   ` Lee Jones
2026-11-23 19:23   ` Anirudh Srinivasan
2026-11-23 19:23     ` Anirudh Srinivasan
2026-11-24 18:31   ` Brian Masney
2026-11-24 18:31     ` Brian Masney
2026-11-26  8:24     ` Lee Jones
2026-11-26  8:24       ` Lee Jones
2026-11-23 16:47 ` [PATCH 09/10] clk: cdce925: Use devm_of_clk_add_hw_provider() to avoid UAF on unbind Lee Jones
2026-11-23 16:47 ` [PATCH 10/10] clk: mmp: audio: Use devm_of_clk_add_hw_provider() to prevent UAF Lee Jones
2026-11-24 18:59 ` (subset) [PATCH 00/10] clk: Assorted bug fixes across clock core and drivers Brian Masney
2026-11-24 18:59   ` Brian Masney
2026-11-26  7:14 ` Krzysztof Kozlowski
2026-11-26  7:14   ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123164834.3330320-8-lee@kernel.org \
    --to=lee@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=amit.daniel@samsung.com \
    --cc=bmasney+clk@redhat.com \
    --cc=cw00.choi@samsung.com \
    --cc=jbrunet+clk@baylibre.com \
    --cc=k.chander@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mihailescu2m@gmail.com \
    --cc=peter.griffin@linaro.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sboyd@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=t.figa@samsung.com \
    --cc=thomas.ab@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.