From: sashiko-bot@kernel.org
To: "Louis-Alexis Eyraud" <louisalexis.eyraud@collabora.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 16/18] clk: mediatek: Add MT8189 i2c clock support
Date: Tue, 21 Jul 2026 10:05:34 +0000 [thread overview]
Message-ID: <20260721100534.7089B1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260720-mt8189-clocks-system-base-v3-16-8e6d99ab3ad2@collabora.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Use-After-Free due to missing of_clk_del_provider() on error path.
--
--- Patch [16]: [PATCH v3 16/18] clk: mediatek: Add MT8189 i2c clock support ---
commit d3f05e8828a2749801c71cd758adfe9c139d7e3f
Author: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
clk: mediatek: Add MT8189 i2c clock support
Add support for the MT8189 i2c clock controller,
which provides clock gate control for i2c.
> diff --git a/drivers/clk/mediatek/clk-mt8189-iic.c b/drivers/clk/mediatek/clk-mt8189-iic.c
> index 0000000000000..80a01706791a4 100644
> --- /dev/null
> +++ b/drivers/clk/mediatek/clk-mt8189-iic.c
[ ... ]
> +static struct platform_driver clk_mt8189_iic_drv = {
> + .probe = mtk_clk_simple_probe,
[Severity: High]
This isn't a bug introduced by this patch, but while reviewing this probe
assignment, I noticed a pre-existing issue in __mtk_clk_simple_probe() (which
mtk_clk_simple_probe wraps).
If mtk_register_reset_controller_with_dev() fails, the error path jumps to
unregister_clks and frees clk_data, but it forgets to unregister the provider:
drivers/clk/mediatek/clk-mtk.c:__mtk_clk_simple_probe() {
...
r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
...
if (mcd->rst_desc) {
r = mtk_register_reset_controller_with_dev(&pdev->dev,
mcd->rst_desc);
if (r)
goto unregister_clks;
}
...
unregister_clks:
...
free_data:
mtk_free_clk_data(clk_data);
...
}
Because of_clk_del_provider(node) is not called on this error path, does this
leave the clock provider registered in the system with a dangling pointer to
the freed clk_data memory? Could this lead to a Use-After-Free if another
driver attempts to look up a clock from this provider?
> + .remove = mtk_clk_simple_remove,
> + .driver = {
> + .name = "clk-mt8189-iic",
> + .of_match_table = of_match_clk_mt8189_iic,
> + },
> +};
> +module_platform_driver(clk_mt8189_iic_drv);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260720-mt8189-clocks-system-base-v3-0-8e6d99ab3ad2@collabora.com?part=16
next prev parent reply other threads:[~2026-07-21 10:05 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 10:04 [PATCH v3 00/18] MT8189: Add support for system and base clock controllers Louis-Alexis Eyraud
2026-07-20 10:04 ` [PATCH v3 01/18] dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8186 Louis-Alexis Eyraud
2026-07-20 10:04 ` [PATCH v3 02/18] dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8192 Louis-Alexis Eyraud
2026-07-21 10:05 ` sashiko-bot
2026-07-20 10:04 ` [PATCH v3 03/18] dt-bindings: clock: mediatek: Make '#clock-cells' required for MT8195 Louis-Alexis Eyraud
2026-07-21 10:05 ` sashiko-bot
2026-07-20 10:04 ` [PATCH v3 04/18] dt-bindings: clock: mediatek: reorder MT8186 compatibles Louis-Alexis Eyraud
2026-07-20 10:04 ` [PATCH v3 05/18] dt-bindings: clock: mediatek: regroup MT8188 dt-bindings into MT8186 Louis-Alexis Eyraud
2026-07-21 10:05 ` sashiko-bot
2026-07-20 10:04 ` [PATCH v3 06/18] dt-bindings: clock: mediatek: regroup MT8192 " Louis-Alexis Eyraud
2026-07-20 10:04 ` [PATCH v3 07/18] dt-bindings: clock: mediatek: regroup MT8195 " Louis-Alexis Eyraud
2026-07-21 10:05 ` sashiko-bot
2026-07-20 10:04 ` [PATCH v3 08/18] dt-bindings: clock: mediatek: Add MT8189 system/base clocks and resets Louis-Alexis Eyraud
2026-07-21 10:05 ` sashiko-bot
2026-07-20 10:04 ` [PATCH v3 09/18] clk: mediatek: Add MT8189 apmixedsys clock support Louis-Alexis Eyraud
2026-07-21 10:05 ` sashiko-bot
2026-07-21 23:04 ` Brian Masney
2026-07-20 10:04 ` [PATCH v3 10/18] clk: mediatek: Add MT8189 topckgen " Louis-Alexis Eyraud
2026-07-21 10:05 ` sashiko-bot
2026-07-20 10:04 ` [PATCH v3 11/18] clk: mediatek: Add MT8189 vlpckgen " Louis-Alexis Eyraud
2026-07-20 10:04 ` [PATCH v3 12/18] clk: mediatek: Add MT8189 vlpcfg " Louis-Alexis Eyraud
2026-07-20 10:04 ` [PATCH v3 13/18] clk: mediatek: Add MT8189 bus " Louis-Alexis Eyraud
2026-07-21 10:05 ` sashiko-bot
2026-07-20 10:04 ` [PATCH v3 14/18] clk: mediatek: Add MT8189 dbgao " Louis-Alexis Eyraud
2026-07-20 10:04 ` [PATCH v3 15/18] clk: mediatek: Add MT8189 dvfsrc " Louis-Alexis Eyraud
2026-07-20 10:04 ` [PATCH v3 16/18] clk: mediatek: Add MT8189 i2c " Louis-Alexis Eyraud
2026-07-21 10:05 ` sashiko-bot [this message]
2026-07-20 10:04 ` [PATCH v3 17/18] clk: mediatek: Add MT8189 scp " Louis-Alexis Eyraud
2026-07-20 10:04 ` [PATCH v3 18/18] clk: mediatek: Add MT8189 ufs " Louis-Alexis Eyraud
2026-07-21 10:05 ` 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=20260721100534.7089B1F00A3D@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