From: sashiko-bot@kernel.org
To: "Sreeshankar K" <sreeshankar0910@gmail.com>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v17 8/8] arm64: dts: qcom: Add SM7250 devicetree file
Date: Tue, 01 Dec 2026 14:17:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-243463@kernel.org> (raw)
In-Reply-To: <20261201-sm7250-v17-8-1477c54422e1@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] cpufreq: qcom-hw: partial init and resource leak in
qcom_cpufreq_hw_cpu_init()
--
commit f4a8749fa80adec47ab07b0f3c55f63260609a20
Author: Sreeshankar K <sreeshankar0910@gmail.com>
arm64: dts: qcom: Add SM7250 devicetree file
This commit adds the base SoC devicetree file for Qualcomm SM7250,
defining CPUs, caches, PSCI idle states, reserved memory, clocks,
interrupt controllers, SPMI, RPMh, cpufreq, and LMh nodes.
> diff --git a/arch/arm64/boot/dts/qcom/sm7250.dtsi b/arch/arm64/boot/dts/qcom/sm7250.dtsi
> new file mode 100644
> index 0000000000000..a47143c091bb0
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/sm7250.dtsi
[ ... ]
> + cpufreq_hw: cpufreq@18323000 {
> + compatible = "qcom,sm7250-cpufreq-hw", "qcom,cpufreq-hw";
> + reg = <0 0x18323000 0 0x1000>,
> + <0 0x18325800 0 0x1000>,
> + <0 0x18327800 0 0x1000>;
> + reg-names = "freq-domain0",
> + "freq-domain1",
> + "freq-domain2";
> + interrupts-extended = <&lmh_cluster0 0>,
> + <&lmh_cluster1 0>;
> + interrupt-names = "dcvsh-irq-0",
> + "dcvsh-irq-1";
> + clocks = <&rpmhcc RPMH_CXO_CLK>, <&gcc GPLL0>;
> + clock-names = "xo", "alternate";
> + #freq-domain-cells = <1>;
> + #clock-cells = <1>;
> + };
[Severity: Medium]
Can defining three frequency domains with only two LMh interrupts here
cause partial cpufreq registration, leaked frequency tables and a
use-after-free of data->policy if the LMh irqdomains are unavailable when
qcom-cpufreq-hw probes (for example when CONFIG_QCOM_LMH=n)?
In qcom_cpufreq_hw_cpu_init(), data->policy is assigned and
qcom_cpufreq_hw_read_lut() allocates policy->freq_table and adds dynamic
OPPs before calling qcom_cpufreq_hw_lmh_init():
drivers/cpufreq/qcom-cpufreq-hw.c:qcom_cpufreq_hw_cpu_init() {
...
data->policy = policy;
ret = qcom_cpufreq_hw_read_lut(cpu_dev, policy);
...
return qcom_cpufreq_hw_lmh_init(policy, index);
}
When lmh_cluster0 and lmh_cluster1 have not registered their irqdomains,
platform_get_irq_optional(pdev, index) returns -EPROBE_DEFER for domains 0
and 1 (CPUs 0..6), whereas domain 2 (CPU 7) has no entry in
interrupts-extended and gets -ENXIO, which qcom_cpufreq_hw_lmh_init()
treats as success.
Because CPU 7 succeeds, cpufreq_register_driver() sees a non-empty policy
list and returns 0 instead of deferring the driver probe. For CPUs 0..6,
cpufreq_policy_online() aborts without calling cpufreq_driver->exit() and
cpufreq_online() frees the failed cpufreq_policy structs. This leaves
CPUs 0..6 without cpufreq support, leaks their policy->freq_table and
OPPs, and leaves data->policy for domains 0 and 1 pointing to freed
memory that qcom_cpufreq_hw_recalc_rate() dereferences when the
registered domain clocks are queried.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-sm7250-v17-0-1477c54422e1@gmail.com?part=8
next prev parent reply other threads:[~2026-12-01 14:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 13:51 [PATCH v17 0/8] Add initial support for Qualcomm SM7250 SoC Sreeshankar K
2026-12-01 13:51 ` [PATCH v17 1/8] dt-bindings: clock: Add SM7250 global clock controller Sreeshankar K
2026-12-01 13:51 ` [PATCH v17 2/8] clk: qcom: Add Global Clock Controller (GCC) driver for SM7250 Sreeshankar K
2026-12-01 13:51 ` [PATCH v17 3/8] thermal/qcom/lmh: Switch to match data for SoC CPU-to-node mappings Sreeshankar K
2026-12-01 13:51 ` [PATCH v17 4/8] dt-bindings: thermal: lmh: Document SM7250 LMh Sreeshankar K
2026-12-01 13:51 ` [PATCH v17 5/8] thermal/qcom/lmh: Add support for Qualcomm SM7250 Sreeshankar K
2026-12-01 13:51 ` [PATCH v17 6/8] dt-bindings: firmware: qcom,scm: Document SM7250 SCM Sreeshankar K
2026-12-01 13:51 ` [PATCH v17 7/8] dt-bindings: cpufreq: qcom-hw: Document SM7250 cpufreq hardware Sreeshankar K
2026-12-01 13:51 ` [PATCH v17 8/8] arm64: dts: qcom: Add SM7250 devicetree file Sreeshankar K
2026-12-01 14:17 ` sashiko-bot [this message]
2026-12-01 13:54 ` [PATCH v17 0/8] Add initial support for Qualcomm SM7250 SoC Konrad Dybcio
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=sashiko-outbox-243463@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sreeshankar0910@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox