From: sashiko-bot@kernel.org
To: "Louis-Alexis Eyraud" <louisalexis.eyraud@collabora.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 18/18] clk: mediatek: Add MT8189 ufs clock support
Date: Fri, 10 Jul 2026 15:09:11 +0000 [thread overview]
Message-ID: <20260710150912.6AD1F1F00A3F@smtp.kernel.org> (raw)
In-Reply-To: <20260709-mt8189-clocks-system-base-v2-18-2926da3db6cf@collabora.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing `of_clk_del_provider()` in the error path of `__mtk_clk_simple_probe()` leaves a dangling clock provider pointer, leading to a potential use-after-free.
--
--- Patch [18]: [PATCH v2 18/18] clk: mediatek: Add MT8189 ufs clock support ---
commit 9858e88b79ed61ffe0a3b2d09755d7d4f94f084e
Author: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
clk: mediatek: Add MT8189 ufs clock support
This commit adds support for the MT8189 UFS clock controller, providing clock
gate control for Universal Flash Storage. It introduces a new driver handling
clock sources, dividers, and gates specific to the MT8189 platform.
> diff --git a/drivers/clk/mediatek/clk-mt8189-ufs.c b/drivers/clk/mediatek/clk-mt8189-ufs.c
> new file mode 100644
> index 0000000000000..85afab04420f8
> --- /dev/null
> +++ b/drivers/clk/mediatek/clk-mt8189-ufs.c
[ ... ]
> +static const struct mtk_clk_rst_desc ufscfg_ao_rst_desc = {
> + .version = MTK_RST_SET_CLR,
> + .rst_bank_ofs = ufscfg_ao_rst_ofs,
> + .rst_bank_nr = ARRAY_SIZE(ufscfg_ao_rst_ofs),
> + .rst_idx_map = ufscfg_ao_rst_idx_map,
> + .rst_idx_map_nr = ARRAY_SIZE(ufscfg_ao_rst_idx_map),
> +};
> +
> +static const struct mtk_clk_desc ufscfg_ao_reg_mcd = {
> + .clks = ufscfg_ao_reg_clks,
> + .num_clks = ARRAY_SIZE(ufscfg_ao_reg_clks),
> + .rst_desc = &ufscfg_ao_rst_desc,
[Severity: High]
This is a pre-existing issue, but does setting .rst_desc here expose a
potential use-after-free in the probe error path?
Looking at __mtk_clk_simple_probe() in drivers/clk/mediatek/clk-mtk.c:
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
if (r)
goto unregister_clks;
platform_set_drvdata(pdev, clk_data);
if (mcd->rst_desc) {
r = mtk_register_reset_controller_with_dev(&pdev->dev,
mcd->rst_desc);
if (r)
goto unregister_clks;
}
If mtk_register_reset_controller_with_dev() fails, the code jumps to
unregister_clks, which frees clk_data without calling of_clk_del_provider().
Any subsequent attempt to resolve a clock from this node could trigger a
use-after-free on the freed clock provider pointer.
Should __mtk_clk_simple_probe() be fixed to cleanly unregister the provider
before this new driver uses .rst_desc?
> +};
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709-mt8189-clocks-system-base-v2-0-2926da3db6cf@collabora.com?part=18
prev parent reply other threads:[~2026-07-10 15:09 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 13:42 [PATCH v2 00/18] MT8189: Add support for system and base clock controllers Louis-Alexis Eyraud
2026-07-09 13:42 ` [PATCH v2 01/18] dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8186 Louis-Alexis Eyraud
2026-07-09 14:01 ` AngeloGioacchino Del Regno
2026-07-09 18:08 ` Conor Dooley
2026-07-09 13:42 ` [PATCH v2 02/18] dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8192 Louis-Alexis Eyraud
2026-07-09 14:01 ` AngeloGioacchino Del Regno
2026-07-09 18:08 ` Conor Dooley
2026-07-09 13:42 ` [PATCH v2 03/18] dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8195 Louis-Alexis Eyraud
2026-07-09 14:01 ` AngeloGioacchino Del Regno
2026-07-09 18:09 ` Conor Dooley
2026-07-10 15:09 ` sashiko-bot
2026-07-09 13:42 ` [PATCH v2 04/18] dt-bindings: clock: mediatek: reorder MT8186 compatibles Louis-Alexis Eyraud
2026-07-09 14:03 ` AngeloGioacchino Del Regno
2026-07-09 18:09 ` Conor Dooley
2026-07-09 13:42 ` [PATCH v2 05/18] dt-bindings: clock: mediatek: regroup MT8188 dt-bindings into MT8186 Louis-Alexis Eyraud
2026-07-09 14:03 ` AngeloGioacchino Del Regno
2026-07-09 18:10 ` Conor Dooley
2026-07-10 15:09 ` sashiko-bot
2026-07-09 13:42 ` [PATCH v2 06/18] dt-bindings: clock: mediatek: regroup MT8192 " Louis-Alexis Eyraud
2026-07-09 14:03 ` AngeloGioacchino Del Regno
2026-07-09 18:10 ` Conor Dooley
2026-07-10 15:09 ` sashiko-bot
2026-07-09 13:42 ` [PATCH v2 07/18] dt-bindings: clock: mediatek: regroup MT8195 " Louis-Alexis Eyraud
2026-07-09 14:03 ` AngeloGioacchino Del Regno
2026-07-09 18:10 ` Conor Dooley
2026-07-09 13:42 ` [PATCH v2 08/18] dt-bindings: clock: mediatek: Add MT8189 clocks Louis-Alexis Eyraud
2026-07-09 14:05 ` AngeloGioacchino Del Regno
2026-07-09 18:12 ` Conor Dooley
2026-07-09 13:42 ` [PATCH v2 09/18] clk: mediatek: Add MT8189 apmixedsys clock support Louis-Alexis Eyraud
2026-07-10 15:09 ` sashiko-bot
2026-07-09 13:42 ` [PATCH v2 10/18] clk: mediatek: Add MT8189 topckgen " Louis-Alexis Eyraud
2026-07-10 15:09 ` sashiko-bot
2026-07-09 13:42 ` [PATCH v2 11/18] clk: mediatek: Add MT8189 vlpckgen " Louis-Alexis Eyraud
2026-07-09 13:42 ` [PATCH v2 12/18] clk: mediatek: Add MT8189 vlpcfg " Louis-Alexis Eyraud
2026-07-09 13:42 ` [PATCH v2 13/18] clk: mediatek: Add MT8189 bus " Louis-Alexis Eyraud
2026-07-09 13:42 ` [PATCH v2 14/18] clk: mediatek: Add MT8189 dbgao " Louis-Alexis Eyraud
2026-07-09 13:42 ` [PATCH v2 15/18] clk: mediatek: Add MT8189 dvfsrc " Louis-Alexis Eyraud
2026-07-10 15:09 ` sashiko-bot
2026-07-09 13:42 ` [PATCH v2 16/18] clk: mediatek: Add MT8189 i2c " Louis-Alexis Eyraud
2026-07-09 13:42 ` [PATCH v2 17/18] clk: mediatek: Add MT8189 scp " Louis-Alexis Eyraud
2026-07-10 15:09 ` sashiko-bot
2026-07-09 13:42 ` [PATCH v2 18/18] clk: mediatek: Add MT8189 ufs " Louis-Alexis Eyraud
2026-07-10 15:09 ` 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=20260710150912.6AD1F1F00A3F@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=louisalexis.eyraud@collabora.com \
--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