From: sashiko-bot@kernel.org
To: "Alex Tran" <alex.tran@oss.qualcomm.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 2/5] cpufreq: scmi-cpufreq: Log number of perf domains
Date: Thu, 14 May 2026 08:06:08 +0000 [thread overview]
Message-ID: <20260514080609.2DDC3C2BCC6@smtp.kernel.org> (raw)
In-Reply-To: <20260513-scmi-client-probe-log-v1-2-00b47b1be009@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] Use-After-Free (UAF) vulnerability due to global state overwrite in multi-SCMI configurations.
- [Low] Misleading and factually incorrect log message regarding initialized performance domains.
--
commit 9067d109b9e937b5bfb6e9d3b3c94d2e9b71d9ac
Author: Alex Tran <alex.tran@oss.qualcomm.com>
cpufreq: scmi-cpufreq: Log number of perf domains
This commit adds a log message to the SCMI cpufreq driver probe function
to display the number of performance domains discovered from firmware.
This is intended to align with the existing SCMI client driver logging
pattern.
> diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
> index 4edb4f7a8aa97..d5c33eea24773 100644
> --- a/drivers/cpufreq/scmi-cpufreq.c
> +++ b/drivers/cpufreq/scmi-cpufreq.c
> @@ -468,9 +468,12 @@ static int scmi_cpufreq_probe(struct scmi_device *sdev)
> if (ret) {
> dev_err(dev, "%s: registering cpufreq failed, err: %d\n",
> __func__, ret);
> + return ret;
> }
>
> - return ret;
> + dev_info(dev, "Initialized %d performance domains\n",
> + perf_ops->num_domains_get(ph));
Is this log message entirely accurate?
The num_domains_get() function returns the total number of performance
domains exposed by the SCMI firmware, which includes domains for other
devices like GPUs or DSPs.
Since the scmi-cpufreq driver only initializes domains explicitly associated
with CPUs, could this log message be misleading during debugging by claiming
all SCMI performance domains were initialized here?
This isn't a bug introduced by this commit, but does the use of the global
perf_ops and ph variables here expose a use-after-free on systems with
multiple SCMI agents?
When a second device probes, it overwrites the global perf_ops and ph handles
earlier in the function:
perf_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_PERF, &ph);
The second probe then calls cpufreq_register_driver(), which fails with
-EEXIST because a cpufreq driver is already registered.
The probe failure triggers devres cleanup for the second device, which calls
scmi_protocol_release() and frees the protocol instance.
Since the global ph pointer now points to freed memory, will subsequent
frequency transitions for the first device's CPUs dereference a dangling
pointer?
> + return 0;
> }
>
> static void scmi_cpufreq_remove(struct scmi_device *sdev)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260513-scmi-client-probe-log-v1-0-00b47b1be009@oss.qualcomm.com?part=2
next prev parent reply other threads:[~2026-05-14 8:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 16:44 [PATCH 0/5] scmi: Log client subsystem entity counts Alex Tran
2026-05-13 16:44 ` [PATCH 1/5] powercap: arm_scmi_powercap: Log number of powercap domains Alex Tran
2026-05-14 7:36 ` sashiko-bot
2026-05-13 16:44 ` [PATCH 2/5] cpufreq: scmi-cpufreq: Log number of perf domains Alex Tran
2026-05-14 8:06 ` sashiko-bot [this message]
2026-05-13 16:44 ` [PATCH 3/5] hwmon: scmi-hwmon: Log number of sensors Alex Tran
2026-05-13 16:47 ` Guenter Roeck
2026-05-14 8:10 ` sashiko-bot
2026-05-13 16:44 ` [PATCH 4/5] reset: reset-scmi: Log number of reset domains Alex Tran
2026-05-14 8:20 ` sashiko-bot
2026-05-13 16:44 ` [PATCH 5/5] pinctrl: pinctrl-scmi: Log number of pins, groups, functions Alex Tran
2026-05-14 9:07 ` sashiko-bot
2026-05-13 18:02 ` [PATCH 0/5] scmi: Log client subsystem entity counts Andy Shevchenko
2026-05-13 18:27 ` Guenter Roeck
2026-05-14 6:48 ` Greg Kroah-Hartman
2026-05-14 10:38 ` Sudeep Holla
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=20260514080609.2DDC3C2BCC6@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alex.tran@oss.qualcomm.com \
--cc=linux-hwmon@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.