From: sashiko-bot@kernel.org
To: "Bjorn Andersson" <bjorn.andersson@oss.qualcomm.com>
Cc: linux-hwmon@vger.kernel.org, Frank.Li@kernel.org,
linux-input@vger.kernel.org, imx@lists.linux.dev,
dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2 2/2] firmware: arm_scmi: request modules for discovered protocols
Date: Thu, 18 Jun 2026 16:15:07 +0000 [thread overview]
Message-ID: <20260618161508.1C5221F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260618-scmi-modalias-v2-2-8c7547c1be21@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Use-After-Free in `scmi_protocol_device_unrequest` during concurrent driver unregistration.
- [High] IDA and SystemPower protocol state leak when the SCMI platform device is unbound.
--
commit 55b65f66dfc5c3002d324389dda6dc66790201cc
Author: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
firmware: arm_scmi: request modules for discovered protocols
This commit enables autoloading for scmi driver modules by emitting a
protocol-level alias for scmi device ID table entries. It requests the
alias when discovering implemented protocols so that driver modules can
be loaded before the concrete client name is available.
> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index 0fd6a947499e7..7d33fab94e281 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
[ ... ]
[Severity: High]
This is a pre-existing issue, but can concurrent driver unregistration
lead to a use-after-free in drivers/firmware/arm_scmi/bus.c?
Looking at scmi_protocol_device_unrequest(), it drops the
scmi_requested_devices_mtx lock to call blocking_notifier_call_chain().
If two threads execute concurrent module unloads for different scmi
drivers on the same protocol:
Thread 1 completes the notifier, re-acquires the lock, and frees phead:
if (list_empty(phead)) {
idr_remove(&scmi_requested_devices, id_table->protocol_id);
kfree(phead);
}
Would Thread 2 then evaluate list_empty(phead) using the just-freed
phead pointer when it finishes its own notifier and re-acquires the lock?
[Severity: High]
This isn't a bug introduced by this patch, but does the scmi platform
device unbinding leak the scmi_bus_id ida and system power protocol state?
When scmi_remove() calls scmi_destroy_protocol_devices() with a NULL
name, it eventually reaches scmi_child_dev_find() in
drivers/firmware/arm_scmi/bus.c:
strscpy(id_table[0].name, name, sizeof(id_table[0].name));
Since strscpy() does not accept a NULL source pointer, doesn't this
trigger a warning and leave the target name empty?
If this empty name causes scmi_dev_match_by_id_table() to fail, the
device won't be found and the manual cleanup in __scmi_device_destroy()
is bypassed.
The device core will then automatically unregister the child devices
using:
static void scmi_device_release(struct device *dev)
{
struct scmi_device *scmi_dev = to_scmi_dev(dev);
kfree_const(scmi_dev->name);
kfree(scmi_dev);
}
Since this release callback skips explicit ida and state cleanup, does
this permanently prevent the system power protocol device from being
recreated if the driver is rebound?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260618-scmi-modalias-v2-0-8c7547c1be21@oss.qualcomm.com?part=2
next prev parent reply other threads:[~2026-06-18 16:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 15:56 [PATCH v2 0/2] firmware: arm_scmi: Ensure automatic module loading Bjorn Andersson
2026-06-18 15:56 ` [PATCH v2 1/2] module: add SCMI device table alias support Bjorn Andersson
2026-06-18 16:16 ` sashiko-bot
2026-06-18 18:16 ` Frank Li
2026-06-18 15:56 ` [PATCH v2 2/2] firmware: arm_scmi: request modules for discovered protocols Bjorn Andersson
2026-06-18 16:15 ` sashiko-bot [this message]
2026-06-18 20:31 ` [PATCH v2 0/2] firmware: arm_scmi: Ensure automatic module loading Hans de Goede
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=20260618161508.1C5221F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=bjorn.andersson@oss.qualcomm.com \
--cc=dmitry.torokhov@gmail.com \
--cc=imx@lists.linux.dev \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-input@vger.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