From: sashiko-bot@kernel.org
To: "Jesse Casco" <jesse.casco@gmail.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH] arm64: dts: qcom: glymur: use polling mode for SCMI transfers
Date: Sat, 08 Aug 2026 17:33:00 +0000 [thread overview]
Message-ID: <20260808173301.B877E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260808172211.137577-1-jesse.casco@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] Dangling pointer in xfer->async_done leads to stack Use-After-Free or NULL pointer dereference on late delayed response.
--
--- Patch [1]: [PATCH] arm64: dts: qcom: glymur: use polling mode for SCMI transfers ---
commit 7c8d066ac6f378514463d4f6eb7b970a95b13e88
Author: Jesse Casco <jesse.casco@gmail.com>
arm64: dts: qcom: glymur: use polling mode for SCMI transfers
This commit marks the SCMI transport on qcom glymur to use polling mode. This
works around the CPUCP firmware writing replies to shared memory but failing
to ring the completion doorbell. Using arm,no-completion-irq ensures the
scmi-cpufreq driver successfully probes.
> diff --git a/arch/arm64/boot/dts/qcom/glymur.dtsi b/arch/arm64/boot/dts/qcom/glymur.dtsi
> index f04058d2e0891..b9db81a19d186 100644
> --- a/arch/arm64/boot/dts/qcom/glymur.dtsi
> +++ b/arch/arm64/boot/dts/qcom/glymur.dtsi
> @@ -412,6 +412,12 @@ scmi {
> mbox-names = "tx", "rx";
> shmem = <&cpu_scp_lpri1>, <&cpu_scp_lpri0>;
>
> + /*
> + * The CPUCP writes SCMI replies into the shmem but
> + * never rings the completion doorbell, so poll.
> + */
> + arm,no-completion-irq;
> +
> #address-cells = <1>;
> #size-cells = <0>;
>
[Severity: Critical]
This isn't a bug introduced by this patch, but could a late delayed response
trigger a data race causing a use-after-free on the async_done stack frame or
a NULL pointer dereference?
In drivers/firmware/arm_scmi/driver.c:do_xfer_with_response(), if a delayed
response takes longer than SCMI_MAX_RESPONSE_TIMEOUT,
wait_for_completion_timeout() times out.
The function sets xfer->async_done = NULL without any synchronization and
returns, destroying the async_response stack frame:
drivers/firmware/arm_scmi/driver.c:do_xfer_with_response() {
...
if (!ret) {
if (!wait_for_completion_timeout(xfer->async_done, timeout)) {
dev_err(ph->dev,
"timed out in delayed resp(caller: %pS)\n",
(void *)_RET_IP_);
ret = -ETIMEDOUT;
} else if (xfer->hdr.status) {
...
}
xfer->async_done = NULL;
...
}
However, the transfer remains in the pending hash table until the caller
invokes xfer_put().
If the delayed response interrupt fires in this window, scmi_handle_response()
can successfully acquire the xfer and unconditionally access the unprotected
async_done pointer:
drivers/firmware/arm_scmi/driver.c:scmi_handle_response() {
...
if (xfer->hdr.type == MSG_TYPE_DELAYED_RESP) {
scmi_clear_channel(info, cinfo);
complete(xfer->async_done);
scmi_inc_count(info->dbg, DELAYED_RESPONSE_OK);
} else {
...
}
Could this lead to stack memory corruption if the async_done stack frame is
already destroyed, or a kernel panic if async_done is read after being set to
NULL?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260808172211.137577-1-jesse.casco@gmail.com?part=1
prev parent reply other threads:[~2026-08-08 17:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 17:22 [PATCH] arm64: dts: qcom: glymur: use polling mode for SCMI transfers Jesse Casco
2026-08-08 17:33 ` 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=20260808173301.B877E1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jesse.casco@gmail.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