devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Abel Vesa" <abel.vesa@oss.qualcomm.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org,
	linux-clk@vger.kernel.org
Subject: Re: [PATCH 03/16] clk: qcom: gcc-sm8450: Tie the CX power domain to controller
Date: Wed, 19 Aug 2026 13:15:51 +0000	[thread overview]
Message-ID: <20260819131552.346841F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260819-qcom-tie-cx-to-gcc-v1-3-840034124e73@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Unbinding the driver causes a devres ordering issue that leads to a lockless linked list Use-After-Free and permanent power leak.
--

--- Patch [3]: [PATCH 03/16] clk: qcom: gcc-sm8450: Tie the CX power domain to controller ---
commit fce258c6d28a3b8028f9c7e9bc3065854572f262
Author: Abel Vesa <abel.vesa@oss.qualcomm.com>

clk: qcom: gcc-sm8450: Tie the CX power domain to controller

Enable runtime PM for the controller so the common GCC probe path resumes
the attached domain while registering clocks, resets and GDSCs. This lets
GDSC consumers propagate their votes through the GCC provider to the CX
parent domain.

> diff --git a/drivers/clk/qcom/gcc-sm8450.c b/drivers/clk/qcom/gcc-sm8450.c
> index b18bb34889ab2..b3ab458048dc8 100644
> --- a/drivers/clk/qcom/gcc-sm8450.c
> +++ b/drivers/clk/qcom/gcc-sm8450.c
> @@ -3399,6 +3399,7 @@ static const struct qcom_cc_desc gcc_sm8450_desc = {
>  	.resets = gcc_sm8450_resets,
>  	.num_resets = ARRAY_SIZE(gcc_sm8450_resets),
>  	.gdscs = gcc_sm8450_gdscs,
> +	.use_rpm = true,

[Severity: High]
This is a pre-existing issue, but will setting use_rpm expose a Use-After-Free
and power leak during driver unbind?

When the driver unbinds, devres cleanup runs qcom_cc_gdsc_unregister(), which
calls gdsc_pm_subdomain_remove(). However, at this point platform_remove() has
already detached the PM domain, making dev->pm_domain NULL.

This causes gdsc_pm_subdomain_remove() in drivers/clk/qcom/gdsc.c to skip the
safe detachment:

	else if (!IS_ERR_OR_NULL(dev->pm_domain))
		pm_genpd_remove_subdomain(pd_to_genpd(dev->pm_domain), &scs[i]->pd);

As a result, an unsafe fallback execution path is taken in
drivers/pmdomain/core.c:genpd_remove():

	list_for_each_entry_safe(link, l, &genpd->child_links, child_node) {
		list_del(&link->parent_node);
		list_del(&link->child_node);
		kfree(link);
	}

This modifies the parent's parent_links list without acquiring the parent's
lock, which could lead to a lockless linked list Use-After-Free. It also
fails to decrement sd_count, which keeps the CX domain powered on forever.

Since devm_add_action_or_reset() in
drivers/clk/qcom/common.c:qcom_cc_really_probe() schedules this cleanup to
happen after dev->pm_domain is cleared, is there a way to address this devres
ordering issue before enabling use_rpm?

>  	.num_gdscs = ARRAY_SIZE(gcc_sm8450_gdscs),
>  };

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260819-qcom-tie-cx-to-gcc-v1-0-840034124e73@oss.qualcomm.com?part=3

  reply	other threads:[~2026-08-19 13:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 12:51 [PATCH 00/16] clk: qcom: Tie CX power domains to GCCs Abel Vesa
2026-08-19 12:51 ` [PATCH 01/16] clk: qcom: gcc-sm8250: Tie the CX power domain to controller Abel Vesa
2026-08-19 15:25   ` Konrad Dybcio
2026-08-19 12:51 ` [PATCH 02/16] clk: qcom: gcc-sm8350: " Abel Vesa
2026-08-19 13:12   ` sashiko-bot
2026-08-19 12:51 ` [PATCH 03/16] clk: qcom: gcc-sm8450: " Abel Vesa
2026-08-19 13:15   ` sashiko-bot [this message]
2026-08-19 12:51 ` [PATCH 04/16] clk: qcom: gcc-sm8550: " Abel Vesa
2026-08-19 12:51 ` [PATCH 05/16] clk: qcom: gcc-sm8650: " Abel Vesa
2026-08-19 12:51 ` [PATCH 06/16] clk: qcom: gcc-sm8750: " Abel Vesa
2026-08-19 12:51 ` [PATCH 07/16] clk: qcom: gcc-kaanapali: " Abel Vesa
2026-08-19 12:51 ` [PATCH 08/16] clk: qcom: gcc-qcs615: " Abel Vesa
2026-08-19 12:51 ` [PATCH 09/16] arm64: dts: qcom: sm8250: Add GCC CX power domain Abel Vesa
2026-08-19 13:08   ` sashiko-bot
2026-08-19 12:51 ` [PATCH 10/16] arm64: dts: qcom: sm8350: " Abel Vesa
2026-08-19 13:05   ` sashiko-bot
2026-08-19 12:51 ` [PATCH 11/16] arm64: dts: qcom: sm8450: " Abel Vesa
2026-08-19 12:51 ` [PATCH 12/16] arm64: dts: qcom: sm8550: " Abel Vesa
2026-08-19 13:03   ` sashiko-bot
2026-08-19 12:51 ` [PATCH 13/16] arm64: dts: qcom: sm8650: " Abel Vesa
2026-08-19 13:09   ` sashiko-bot
2026-08-19 12:51 ` [PATCH 14/16] arm64: dts: qcom: sm8750: " Abel Vesa
2026-08-19 12:52 ` [PATCH 15/16] arm64: dts: qcom: kaanapali: " Abel Vesa
2026-08-19 12:52 ` [PATCH 16/16] arm64: dts: qcom: talos: " Abel Vesa

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=20260819131552.346841F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=abel.vesa@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).