Linux clock framework development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sasha Levin" <sashal@kernel.org>
Cc: linux-clk@vger.kernel.org
Subject: Re: [PATCH AUTOSEL 6.18] clk: qcom: clk-rpmh: Make all VRMs optional
Date: Mon, 31 Aug 2026 14:15:42 +0000	[thread overview]
Message-ID: <20260831141542.923BD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831133314.4125787-81-sashal@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The clk-rpmh driver permanently mutates static global clock structures during probe, leading to severe resource address corruption on probe deferral or unbind/rebind.
--

commit db440aeaf96923e7980cc52bc879e1c6dfac5bf7
Author: Alexander Koskovich <akoskovich@pm.me>

clk: qcom: clk-rpmh: Make all VRMs optional

This commit marks all VRM clocks as optional to prevent probe failures on
boards where not all VRMs are present. It resolves issues on devices with
different PMIC configurations by checking the VRM offset directly.

Link: https://lore.kernel.org/r/20260414-clk-rpmh-vrm-opt-v3-1-8ca21469ffbc@pm.me

> diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
> index 63c38cb47bc45..82f18e15cd77b 100644
> --- a/drivers/clk/qcom/clk-rpmh.c
> +++ b/drivers/clk/qcom/clk-rpmh.c

[ ... ]

> @@ -943,8 +938,7 @@ static int clk_rpmh_probe(struct platform_device *pdev)
>  		if (!res_addr) {
>  			hw_clks[i] = NULL;
>  
[Severity: High]
This is a pre-existing issue, but does this code permanently mutate static
global structures during probe?

Looking at clk_rpmh_probe(), it uses statically allocated arrays like
sm8550_rpmh_clocks and static structures. When the assignment above is
executed, it permanently clears missing clocks from the shared array.

Additionally, further down in this same function, the dynamic cmd-db address
is added to the static structure's initial offset:

    rpmh_clk->res_addr += res_addr;

If the driver is unbound and rebound via sysfs, or if probe defers, the
structure retains these mutated states. The probe path will erroneously add
the cmd-db address a second time for existing clocks, and missing clocks
will remain permanently NULL.

Could this lead to severe resource address corruption when issuing RPMh
commands to these accumulated addresses? Could a privileged user trigger
a sysfs unbind/bind cycle to corrupt the state and break SoC clock
management?

> -			if (desc->clka_optional &&
> -			    !strncmp(rpmh_clk->res_name, "clka", sizeof("clka") - 1))
> +			if (rpmh_clk->res_addr == CLK_RPMH_VRM_EN_OFFSET)
>  				continue;
>  
>  			dev_err(&pdev->dev, "missing RPMh resource address for %s\n",

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260831133314.4125787-81-sashal@kernel.org?part=1

  reply	other threads:[~2026-08-31 14:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260831133314.4125787-1-sashal@kernel.org>
2026-08-31 13:20 ` [PATCH AUTOSEL 6.18-5.10] clk: keystone: don't cache clock rate Sasha Levin
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18-5.10] clk: socfpga: agilex: implement l3_main_free_clk Sasha Levin
2026-08-31 14:10   ` sashiko-bot
2026-08-31 13:21 ` [PATCH AUTOSEL 6.18] clk: qcom: clk-rpmh: Make all VRMs optional Sasha Levin
2026-08-31 14:15   ` sashiko-bot [this message]
2026-08-31 13:23 ` [PATCH AUTOSEL 6.18-6.1] clk: samsung: exynos850: mark APM I3C clocks as critical Sasha Levin
2026-08-31 13:24 ` [PATCH AUTOSEL 6.18] clk: clk-axi-clkgen: Add support versal timings Sasha Levin
2026-08-31 15:02   ` sashiko-bot
2026-08-31 13:25 ` [PATCH AUTOSEL 6.18-5.10] clk: renesas: cpg-mssr: Add number of clock cells check Sasha Levin
2026-08-31 13:29 ` [PATCH AUTOSEL 6.18] clk: samsung: exynos990: Fix PERIC0/1 USI clock types Sasha Levin
2026-08-31 16:57   ` sashiko-bot

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=20260831141542.923BD1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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