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>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Takashi Sakamoto" <o-takashi@sakamocchi.jp>,
	"Uwe Kleine-König (The Capable Hub)"
	<u.kleine-koenig@baylibre.com>,
	"Pankaj Dubey" <pankaj.dubey@samsung.com>,
	"Ajay Kumar" <ajaykumar.rs@samsung.com>,
	"Jayati Sahu" <jayati.sahu@samsung.com>,
	"Smitha T Murthy" <smitha.t@samsung.com>,
	"Sathyakam M" <sathya@samsung.com>,
	linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 12/12] clk: samsung: fsd: Terminate PLL rate tables with sentinels
Date: Fri, 27 Nov 2026 18:03:20 +0000	[thread overview]
Message-ID: <20261127180416.3277544-13-lee@kernel.org> (raw)
In-Reply-To: <20261127180416.3277544-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, 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@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 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


  parent reply	other threads:[~2026-11-27 18:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 18:03 [PATCH 00/12] clk: samsung: Fix power-domain, bus clock, and missing PLL sentinel bugs Lee Jones
2026-11-27 18:03 ` [PATCH 01/12] clk: samsung: exynos5-subcmu: Detach power domain on add failure Lee Jones
2026-11-27 18:03 ` [PATCH 02/12] clk: samsung: exynos-arm64: Do not store ERR_PTR in data->clk Lee Jones
2026-11-27 18:03 ` [PATCH 03/12] clk: samsung: artpec8: Terminate PLL rate table with sentinel Lee Jones
2026-11-30 14:38   ` Jesper Nilsson
2026-11-27 18:03 ` [PATCH 04/12] clk: samsung: artpec9: Terminate PLL rate tables with sentinels Lee Jones
2026-11-30 14:38   ` Jesper Nilsson
2026-11-27 18:03 ` [PATCH 05/12] clk: samsung: exynos5250: Terminate PLL rate table with sentinel Lee Jones
2026-11-27 18:03 ` [PATCH 06/12] clk: samsung: exynos5260: Terminate PLL rate tables with sentinels Lee Jones
2026-11-27 18:03 ` [PATCH 07/12] clk: samsung: exynos5410: Terminate PLL rate table with sentinel Lee Jones
2026-11-27 18:03 ` [PATCH 08/12] clk: samsung: exynos7885: " Lee Jones
2026-11-27 18:03 ` [PATCH 09/12] clk: samsung: exynos850: " Lee Jones
2026-11-27 18:03 ` [PATCH 10/12] clk: samsung: exynos8895: Terminate PLL rate tables with sentinels Lee Jones
2026-11-28 13:38   ` ivaylo ivanov
2026-11-27 18:03 ` [PATCH 11/12] clk: samsung: exynosautov920: Terminate PLL rate table with sentinel Lee Jones
2026-11-27 18:03 ` Lee Jones [this message]
2026-12-01  4:58 ` [PATCH 00/12] clk: samsung: Fix power-domain, bus clock, and missing PLL sentinel bugs Krzysztof Kozlowski
2026-12-01 10:51   ` Lee Jones

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=20261127180416.3277544-13-lee@kernel.org \
    --to=lee@kernel.org \
    --cc=ajaykumar.rs@samsung.com \
    --cc=alim.akhtar@samsung.com \
    --cc=bhelgaas@google.com \
    --cc=bmasney+clk@redhat.com \
    --cc=cw00.choi@samsung.com \
    --cc=dakr@kernel.org \
    --cc=jayati.sahu@samsung.com \
    --cc=jbrunet+clk@baylibre.com \
    --cc=krzk@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=o-takashi@sakamocchi.jp \
    --cc=pankaj.dubey@samsung.com \
    --cc=peter.griffin@linaro.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sathya@samsung.com \
    --cc=sboyd@kernel.org \
    --cc=smitha.t@samsung.com \
    --cc=stable@vger.kernel.org \
    --cc=u.kleine-koenig@baylibre.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.