From: sashiko-bot@kernel.org
To: "Jernej Skrabec" <jernej.skrabec@gmail.com>
Cc: devicetree@vger.kernel.org, krzk+dt@kernel.org, robh@kernel.org,
conor+dt@kernel.org
Subject: Re: [PATCH v2 2/8] clk: sunxi-ng: de2: Export register regmap for DE33
Date: Sat, 09 May 2026 20:05:19 +0000 [thread overview]
Message-ID: <20260509200520.60926C2BCB2@smtp.kernel.org> (raw)
In-Reply-To: <20260509190015.79086-3-jernej.skrabec@siol.net>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] Use-after-free and permanent probe failure due to registering a devm-managed regmap with syscon.
- [High] Unconditional probe failure if `CONFIG_MFD_SYSCON` is disabled.
--
commit ef866c925d5c9b0231c3dc8c7b9a9590e11b86ec
Author: Jernej Skrabec <jernej.skrabec@gmail.com>
clk: sunxi-ng: de2: Export register regmap for DE33
This commit adds a regmap for DE33 plane mapping registers and registers
it via syscon so the DRM driver can access them.
> diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c
> --- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c
> +++ b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c
[ ... ]
> @@ -336,13 +368,23 @@ static int sunxi_de2_clk_probe(struct platform_device *pdev)
> }
>
> /*
> - * The DE33 requires these additional (unknown) registers set
> + * The DE33 requires these additional plane mapping registers set
> * during initialisation.
> */
> if (of_device_is_compatible(pdev->dev.of_node,
> "allwinner,sun50i-h616-de33-clk")) {
> - writel(0, reg + 0x24);
> - writel(0x0000a980, reg + 0x28);
> + struct regmap *regmap;
> +
> + regmap = devm_regmap_init_mmio(&pdev->dev, reg,
> + &sun8i_de2_ccu_regmap_config);
> + if (IS_ERR(regmap)) {
> + ret = PTR_ERR(regmap);
> + goto err_assert_reset;
> + }
> +
> + ret = of_syscon_register_regmap(dev_of_node(&pdev->dev), regmap);
> + if (ret)
> + goto err_assert_reset;
If syscon is disabled in the kernel configuration, the inline stub for
of_syscon_register_regmap() returns -EOPNOTSUPP. Will this unconditionally
fail the probe for the core display clock controller on systems without syscon
enabled?
Additionally, is it safe to register a devm-managed regmap with syscon?
of_syscon_register_regmap() adds the regmap to a global list but provides no
deregistration mechanism, as syscon assumes permanent mappings.
If the driver module is unbound by a user via sysfs, or if the subsequent
devm_sunxi_ccu_probe() call fails, devres will automatically free the regmap
and unmap the MMIO.
Would this leave a dangling pointer in the global syscon list, leading to a
use-after-free when the DRM driver looks it up? Also, wouldn't a subsequent
attempt to re-bind fail permanently with -EEXIST?
> }
>
> ret = devm_sunxi_ccu_probe(&pdev->dev, reg, ccu_desc);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260509190015.79086-1-jernej.skrabec@siol.net?part=2
next prev parent reply other threads:[~2026-05-09 20:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-09 19:00 [PATCH v2 0/8] drm/sun4i: update DE33 support Jernej Skrabec
2026-05-09 19:00 ` [PATCH v2 1/8] clk: sunxi-ng: de2: Fix Display Engine 3.3 definitions Jernej Skrabec
2026-05-09 19:44 ` sashiko-bot
2026-05-10 19:11 ` Jernej Škrabec
2026-05-09 19:00 ` [PATCH v2 2/8] clk: sunxi-ng: de2: Export register regmap for DE33 Jernej Skrabec
2026-05-09 20:05 ` sashiko-bot [this message]
2026-05-09 19:00 ` [PATCH v2 3/8] drm/sun4i: Add support for DE33 CSC Jernej Skrabec
2026-05-09 19:00 ` [PATCH v2 4/8] drm/sun4i: vi_layer: Limit formats for DE33 Jernej Skrabec
2026-05-09 20:58 ` sashiko-bot
2026-05-09 19:00 ` [PATCH v2 5/8] dt-bindings: display: allwinner: Add DE33 planes Jernej Skrabec
2026-05-09 21:12 ` sashiko-bot
2026-05-09 19:00 ` [PATCH v2 6/8] drm/sun4i: Add planes driver Jernej Skrabec
2026-05-09 21:31 ` sashiko-bot
2026-05-09 19:00 ` [PATCH v2 7/8] dt-bindings: display: allwinner: Split H616 DE33 layer reg space Jernej Skrabec
2026-05-09 19:00 ` [PATCH v2 8/8] drm/sun4i: switch DE33 to new bindings Jernej Skrabec
2026-05-09 22:00 ` 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=20260509200520.60926C2BCB2@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jernej.skrabec@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=robh@kernel.org \
--cc=sashiko@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