From: sashiko-bot@kernel.org
To: "Yu-Chun Lin" <eleanor.lin@realtek.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v12 09/11] clk: realtek: Add RTD1625-CRT clock controller driver
Date: Tue, 04 Aug 2026 17:12:14 +0000 [thread overview]
Message-ID: <20260804171215.5BF9E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804163807.1285869-10-eleanor.lin@realtek.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Nullifying `regmap` in `rtk_clk_remove` introduces a race condition that leads to a NULL pointer dereference if the driver is unbound via sysfs.
--
--- Patch [9]: [PATCH v12 09/11] clk: realtek: Add RTD1625-CRT clock controller driver ---
commit 9b8b892d0fe2cab055b1375b43022988ae2354a2
Author: Cheng-Yu Lee <cylee12@realtek.com>
clk: realtek: Add RTD1625-CRT clock controller driver
Add support for the CRT (Clock, Reset, and Test) domain clock controller
on the Realtek RTD1625 SoC. This driver acts as the parent device and
registers the reset controller as an auxiliary device on the auxiliary bus.
> diff --git a/drivers/clk/realtek/clk-rtd1625-crt.c b/drivers/clk/realtek/clk-rtd1625-crt.c
> new file mode 100644
> index 0000000000000..982ef73785ac5
> --- /dev/null
> +++ b/drivers/clk/realtek/clk-rtd1625-crt.c
[ ... ]
> +static struct platform_driver rtd1625_crt_driver = {
> + .probe = rtd1625_crt_probe,
> + .remove = rtk_clk_remove,
[Severity: High]
Does adding this remove callback and allowing sysfs unbind expose a NULL
pointer dereference race condition?
Because the clocks are registered using devm_clk_hw_register() in
rtk_clk_probe(), they are unregistered during devres cleanup, which
happens after rtk_clk_remove() completes.
Looking at rtk_clk_remove() in clk-rtk-common.c, it explicitly sets the
regmap to NULL:
for (int i = 0; i < desc->num_clks; i++)
desc->clks[i]->regmap = NULL;
If a concurrent clock operation occurs (like reading the debugfs
clk_summary) between rtk_clk_remove() returning and the devres cleanup
finishing, will CCF invoke the clock callbacks with a NULL regmap and
cause a kernel panic in regmap_read()?
> + .driver = {
> + .name = "rtk-rtd1625-crt-clk",
> + .of_match_table = rtd1625_crt_match,
> + },
> +};
> +
> +module_platform_driver(rtd1625_crt_driver)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804163807.1285869-1-eleanor.lin@realtek.com?part=9
next prev parent reply other threads:[~2026-08-04 17:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 16:37 [PATCH v12 00/11] clk / reset: realtek: Add RTD1625 clock and reset support Yu-Chun Lin
2026-08-04 16:37 ` [PATCH v12 01/11] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller Yu-Chun Lin
2026-08-04 16:37 ` [PATCH v12 02/11] reset: Add Realtek basic reset support Yu-Chun Lin
2026-08-04 16:37 ` [PATCH v12 03/11] reset: realtek: Add RTD1625 reset controller driver Yu-Chun Lin
2026-08-04 16:38 ` [PATCH v12 04/11] clk: realtek: Introduce common probe() and remove() Yu-Chun Lin
2026-08-04 16:54 ` sashiko-bot
2026-08-04 16:38 ` [PATCH v12 05/11] clk: realtek: Add support for phase locked loops (PLLs) Yu-Chun Lin
2026-08-04 16:38 ` [PATCH v12 06/11] clk: realtek: Add support for gate clock Yu-Chun Lin
2026-08-04 16:38 ` [PATCH v12 07/11] clk: realtek: Add support for mux clock Yu-Chun Lin
2026-08-04 16:38 ` [PATCH v12 08/11] clk: realtek: Add support for MMC-tuned PLL clocks Yu-Chun Lin
2026-08-04 16:38 ` [PATCH v12 09/11] clk: realtek: Add RTD1625-CRT clock controller driver Yu-Chun Lin
2026-08-04 17:12 ` sashiko-bot [this message]
2026-08-04 16:38 ` [PATCH v12 10/11] clk: realtek: Add RTD1625-ISO " Yu-Chun Lin
2026-08-04 17:05 ` sashiko-bot
2026-08-04 16:38 ` [PATCH v12 11/11] arm64: dts: realtek: Add clock support for RTD1625 Yu-Chun Lin
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=20260804171215.5BF9E1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=eleanor.lin@realtek.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