From: sashiko-bot@kernel.org
To: "Alex Elder" <elder@riscstar.com>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 4/4] arm64: dts: qcom: qcs6490-rb3gen2: add TC9564 clock node
Date: Thu, 03 Dec 2026 20:28:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-248633@kernel.org> (raw)
In-Reply-To: <20261203200948.1595470-5-elder@riscstar.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] arm64: dts: qcom: BAR4 translation fails for TC9564
clock-controller@1004
- [Medium] clk: toshiba: devm_reset_register() frees aux_data before
auxdev destroy
- [Medium] clk: toshiba: devm_reset_register() leaks aux_data on
ida_alloc() failure
--
commit 179c9f9b50bcdb23af6216cf3aeac69795b3017e
Author: Alex Elder <elder@kernel.org>
arm64: dts: qcom: qcs6490-rb3gen2: add TC9564 clock node
This commit adds a fixed 25 MHz crystal clock node and a TC9564 clock and
reset controller node under pci-ep-bus@4 in the QCS6490 RB3Gen2 device tree.
> diff --git a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
> index 682bcbc0b466b..87035745b6720 100644
> --- a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
> +++ b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
[ ... ]
> @@ -969,6 +976,14 @@ pci-ep-bus@4 {
> #size-cells = <1>;
> /* Map 0x0-0x1fffff to BAR 4 */
> ranges = <0x0 0x4 0x0 0x0 0x200000>;
> +
> + clock-controller@1004 {
> + compatible = "toshiba,tc9564-clock";
> + reg = <0x1004 0x10>;
> + clocks = <&tc9564_xo_board>;
> + #clock-cells = <1>;
> + #reset-cells = <1>;
> + };
[Severity: High]
Can address translation for clock-controller@1004 succeed with dev@0,0's
static placeholder ranges?
During PCI enumeration, pci_setup_device() -> pci_set_of_node() binds the
static dev@0,0 node to the PCI device. Because pci_device_to_OF_node() is
then already non-NULL, the final fixup of_pci_make_dev_node() returns early
without updating dev@0,0's ranges property.
When tc9564_function_probe() populates the bus, of_address_to_resource()
translates reg = <0x1004 0x10> via the stale BAR 4 range to 0x85004, outside
pcie1's 0x40300000 MEM window in kodiak.dtsi. of_device_alloc() then hits
WARN_ON(rc) and tc9564_clk_probe() fails with -EINVAL.
[Severity: Medium]
In the bound clock driver from commit "clk: toshiba: introduce a TC9564
clock driver", does devm_reset_register() in drivers/clk/clk-tc9564.c free
aux_data and the IDA ID while the auxiliary device is still registered?
__devm_auxiliary_device_create() registers auxiliary_device_destroy() as a
devres action before returning. Registering reset_adev_free() afterwards
means LIFO teardown frees aux_data and calls ida_free() before
auxiliary_device_destroy() removes the device:
CPU0 CPU1
devres_release_all()
reset_adev_free()
ida_free(&reset_ids, adev->id)
kfree(aux_data)
tc9564_reset_probe()
aux_data = dev_get_platdata(dev)
aux_data->regs <-- use-after-free
auxiliary_device_destroy()
Registering cleanup for aux_data and the IDA ID before creating the
auxiliary device avoids both the use-after-free and early ID reuse.
[Severity: Medium]
Also in drivers/clk/clk-tc9564.c:devm_reset_register(), does the ida_alloc()
error path leak aux_data? aux_data is allocated with kzalloc_obj() right
before ida_alloc(), but an allocation failure returns dev_err_probe()
without calling kfree(aux_data).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203200948.1595470-1-elder@riscstar.com?part=4
prev parent reply other threads:[~2026-12-03 20:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 20:09 [PATCH v5 0/4] clk: tc9564: introduce clock and reset drivers Alex Elder
2026-12-03 20:09 ` [PATCH v5 1/4] dt-bindings: toshiba: introduce toshiba,tc9564-clock.yaml Alex Elder
2026-12-03 20:18 ` sashiko-bot
2026-12-03 20:09 ` [PATCH v5 2/4] reset: toshiba: introduce a TC9564 reset driver Alex Elder
2026-12-03 20:24 ` sashiko-bot
2026-12-03 20:09 ` [PATCH v5 3/4] clk: toshiba: introduce a TC9564 clock driver Alex Elder
2026-12-03 20:22 ` sashiko-bot
2026-12-03 20:09 ` [PATCH v5 4/4] arm64: dts: qcom: qcs6490-rb3gen2: add TC9564 clock node Alex Elder
2026-12-03 20:28 ` sashiko-bot [this message]
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-248633@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=elder@riscstar.com \
--cc=linux-clk@vger.kernel.org \
--cc=robh@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