From: sashiko-bot@kernel.org
To: "Lee Jones" <lee@kernel.org>, linux-clk@vger.kernel.org
Subject: Re: [PATCH 02/10] clk: tegra: bpmp: Drop manual clock unregister on provider failure
Date: Fri, 27 Nov 2026 19:36:12 +0000 [thread overview]
Message-ID: <sashiko-outbox-238171@kernel.org> (raw)
In-Reply-To: <20261127192620.3443537-3-lee@kernel.org>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] clk: tegra: error pointer dereference in
tegra_bpmp_clk_of_xlate() [1]
--
commit 44882aa0bdd34b806a054776ef80a0aa5e952e08
Author: Lee Jones <lee@kernel.org>
clk: tegra: bpmp: Drop manual clock unregister on provider failure
This commit removes tegra_bpmp_unregister_clocks() and its call on
of_clk_add_hw_provider() failure so devres handles clock cleanup without
dereferencing error pointers or double-unregistering clocks.
> diff --git a/drivers/clk/tegra/clk-bpmp.c b/drivers/clk/tegra/clk-bpmp.c
> index 3649324e2e1fd..e4b4f3eec7773 100644
> --- a/drivers/clk/tegra/clk-bpmp.c
> +++ b/drivers/clk/tegra/clk-bpmp.c
> @@ -648,14 +648,6 @@ static int tegra_bpmp_register_clocks(struct tegra_bpmp *bpmp,
> return 0;
> }
>
> -static void tegra_bpmp_unregister_clocks(struct tegra_bpmp *bpmp)
> -{
> - unsigned int i;
> -
> - for (i = 0; i < bpmp->num_clocks; i++)
> - clk_hw_unregister(&bpmp->clocks[i]->hw);
> -}
> -
> static struct clk_hw *tegra_bpmp_clk_of_xlate(struct of_phandle_args *clkspec,
> void *data)
> {
[Severity: High]
This problem wasn't introduced by this patch, but can
tegra_bpmp_clk_of_xlate() also dereference an error pointer in
bpmp->clocks[i] [1]?
drivers/clk/tegra/clk-bpmp.c:tegra_bpmp_clk_of_xlate() {
...
for (i = 0; i < bpmp->num_clocks; i++) {
struct tegra_bpmp_clk *clk = bpmp->clocks[i];
if (!clk)
continue;
if (clk->id == id)
return &clk->hw;
}
...
}
Because tegra_bpmp_register_clocks_one() stores ERR_PTR values in
bpmp->clocks[i] when a clock fails to register, checking only !clk before
reading clk->id will crash during device tree clock lookup. Should this
check IS_ERR_OR_NULL(clk)?
[1] https://sashiko.dev/#/bug/linux-3d54138a-c3d2-4466-952a-f7e44259adfe
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127192620.3443537-1-lee@kernel.org?part=2
next prev parent reply other threads:[~2026-11-27 19:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 19:25 [PATCH 00/10] clk: Fix OOB writes, UAFs, ERR_PTR dereferences, and rate-calc bugs (batch 2) Lee Jones
2026-11-27 19:25 ` [PATCH 01/10] clk: ti: fapll: Fix output clock array allocation and bounds check Lee Jones
2026-11-27 19:36 ` sashiko-bot
2026-11-27 19:25 ` [PATCH 02/10] clk: tegra: bpmp: Drop manual clock unregister on provider failure Lee Jones
2026-11-27 19:36 ` sashiko-bot [this message]
2026-11-27 19:25 ` [PATCH 03/10] clk: starfive: jh7110-sys: Use devres for PLL0 clock and notifier Lee Jones
2026-11-27 19:25 ` [PATCH 04/10] clk: starfive: jh7110: Duplicate top clock bulk arrays per device Lee Jones
2026-11-27 19:25 ` [PATCH 05/10] clk: rockchip: cpu: Allocate rate_table before registering notifier Lee Jones
2026-11-27 19:33 ` sashiko-bot
2026-11-27 19:25 ` [PATCH 06/10] clk: tegra: bpmp: Skip ERR_PTR entries in tegra_bpmp_clk_of_xlate() Lee Jones
2026-11-27 19:25 ` [PATCH 07/10] clk: rp1: Propagate determine_rate() return value for PLL dividers Lee Jones
2026-11-27 19:25 ` [PATCH 08/10] clk: rp1: Reference secondary PLL divider clk_hw in parent tables Lee Jones
2026-11-27 19:25 ` [PATCH 09/10] clk: keystone: sci-clk: Check allocation failure before copying clock array Lee Jones
2026-11-27 19:25 ` [PATCH 10/10] clk: versatile: icst: Check kasprintf() and put parent node on error 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=sashiko-outbox-238171@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=lee@kernel.org \
--cc=linux-clk@vger.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