Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 04/10] clk: composite: Initialise sub-hw pointers in determine_rate()
Date: Mon, 23 Nov 2026 16:47:37 +0000	[thread overview]
Message-ID: <20261123164834.3330320-5-lee@kernel.org> (raw)
In-Reply-To: <20261123164834.3330320-1-lee@kernel.org>

__clk_hw_register_composite() leaves mux_hw->core and rate_hw->core
unset at registration time, relying on the composite callbacks to bind
them via __clk_hw_set_clk().  While the fallback branches of
clk_composite_determine_rate() and clk_composite_set_rate_and_parent()
call __clk_hw_set_clk(), the primary rate + mux branch omits it.

When a composite clock with both rate and mux operations has only a
single parent, __clk_init_parent() skips .get_parent(), leaving
mux_hw->core NULL.  Subsequent calls to clk_hw_get_parent(mux_hw) or
clk_hw_get_num_parents(mux_hw) in clk_composite_determine_rate() then
dereference NULL.

Call __clk_hw_set_clk() for both rate_hw and mux_hw in the primary
branch of clk_composite_determine_rate().

Fixes: 2f508a955a67 ("clk: Convert basic types to clk_hw based provider APIs")
Closes: https://sashiko.dev/#/bug/linux-55b1d094-a5a2-44a2-b323-dddc52661f32
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/clk/clk-composite.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index 11842bce5918..c7c1ff590e14 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -69,6 +69,8 @@ static int clk_composite_determine_rate(struct clk_hw *hw,
 
 	if (rate_hw && rate_ops && rate_ops->determine_rate &&
 	    mux_hw && mux_ops && mux_ops->set_parent) {
+		__clk_hw_set_clk(rate_hw, hw);
+		__clk_hw_set_clk(mux_hw, hw);
 		req->best_parent_hw = NULL;
 
 		if (clk_hw_get_flags(hw) & CLK_SET_RATE_NO_REPARENT) {
-- 
2.56.1.750.gf70dc682cf-goog


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

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261123164834.3330320-1-lee@kernel.org>
2026-11-23 16:47 ` [PATCH 01/10] clk: imx: imx8qxp-lpcg: Prevent stack overflow when parsing clocks Lee Jones
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 ` Lee Jones [this message]
2026-11-23 16:47 ` [PATCH 05/10] clk: divider: Avoid division by zero in _div_round_closest() 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 ` [PATCH 07/10] clk: samsung: exynos5420: Terminate PLL rate tables with sentinels Lee Jones
2026-11-23 16:47 ` [PATCH 08/10] clk: tenstorrent: Poll atomically in atlantis_clk_pll_enable() 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

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-5-lee@kernel.org \
    --to=lee@kernel.org \
    --cc=bmasney+clk@redhat.com \
    --cc=jbrunet+clk@baylibre.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox