From: sashiko-bot@kernel.org
To: "Herman van Hazendonk" <github.com@herrie.org>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/2] interconnect: qcom: add MSM8x60 NoC driver
Date: Sun, 31 May 2026 04:34:15 +0000 [thread overview]
Message-ID: <20260531043416.604C41F00893@smtp.kernel.org> (raw)
In-Reply-To: <314e71d651e4bbe9eedc904d3b94cf306ce5aab5.1780197411.git.github.com@herrie.org>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] Clock prepare/enable reference leak on probe deferral when RPM device lookup fails.
- [High] Time-of-check to time-of-use (TOCTOU) race condition in `msm8660_get_rpm` leading to Use-After-Free.
- [High] Integer truncation in the fabric clock rate calculation allows unprivileged processes to freeze the interconnect bus.
- [Low] `COUNT_ARGS(__VA_ARGS__)` evaluates to 1 when no arguments are passed, creating bogus links to node ID 0.
--
commit 3b79422423710904c503ef7d19429d69c2f02d18
Author: Herman van Hazendonk <github.com@herrie.org>
interconnect: qcom: add MSM8x60 NoC driver
Add a Qualcomm interconnect driver for the MSM8x60 family, modelling the
four fabrics that connect masters and slaves on these Scorpion-class SoCs.
The driver implements the interconnect-provider API to manage bandwidth
between specific masters and slaves.
> diff --git a/drivers/interconnect/qcom/msm8660.c b/drivers/interconnect/qcom/msm8660.c
> new file mode 100644
> index 0000000000000..174bc59da74f7
> --- /dev/null
> +++ b/drivers/interconnect/qcom/msm8660.c
> @@ -0,0 +1,1069 @@
[ ... ]
> +#define DEFINE_QNODE(_name, _id, _buswidth, _mas, _slv, _tier, ...) \
> + static struct msm8660_icc_node _name = { \
> + .name = #_name, \
> + .id = _id, \
> + .buswidth = _buswidth, \
> + .num_links = COUNT_ARGS(__VA_ARGS__), \
[Severity: Low]
Does COUNT_ARGS(__VA_ARGS__) evaluate to 1 when invoked with no links?
When DEFINE_QNODE is invoked with an empty variadic argument list, this
might receive a single empty token and initialize .links to { 0 },
causing a phantom node with ID 0 to be created.
[ ... ]
> +static int msm8660_icc_set(struct icc_node *src, struct icc_node *dst)
> +{
[ ... ]
> + /* Apply minimum floor to prevent bus starvation */
> + rate = max_t(u64, rate, MSM8660_FABRIC_MIN_RATE);
> + rate = min_t(u32, rate, INT_MAX);
[Severity: High]
Can this truncation bypass the minimum floor limit?
If rate exceeds the 32-bit maximum (for example, during very high
bandwidth requests), the cast to u32 in min_t() will truncate the upper
bits. This could result in a near-zero clock rate instead of capping it,
potentially freezing the interconnect bus.
[ ... ]
> +static struct qcom_rpm *msm8660_get_rpm(struct device *dev)
> +{
[ ... ]
> + rpm_pdev = of_find_device_by_node(rpm_np);
> + of_node_put(rpm_np);
> + if (!rpm_pdev) {
> + dev_dbg(dev, "RPM device not found yet, deferring probe\n");
> + return ERR_PTR(-EPROBE_DEFER);
> + }
> +
> + rpm = dev_get_drvdata(&rpm_pdev->dev);
[Severity: High]
Could this lead to a race condition between retrieving the pointer and
pinning the device?
Because dev_get_drvdata() retrieves the pointer before device_link_add()
pins the supplier, a concurrent unbind and rebind of the supplier in this
window could cause the original pointer to be freed, even though the link
might succeed on the rebound instance, leading to a use-after-free.
[ ... ]
> +static int msm8660_icc_probe(struct platform_device *pdev)
> +{
[ ... ]
> + if (qp->num_clks) {
> + ret = clk_bulk_prepare_enable(qp->num_clks, qp->bus_clks);
> + if (ret) {
> + dev_warn(dev, "Failed to enable bus clocks: %d\n", ret);
> + qp->num_clks = 0;
> + }
> + }
> +
> + /* Set up RPM fabric arbitration */
> + qp->desc = desc;
> + if (desc->rpm_resource >= 0) {
> + qp->rpm = msm8660_get_rpm(dev);
> + if (IS_ERR(qp->rpm))
> + return PTR_ERR(qp->rpm);
[Severity: High]
Does returning directly here leak the clock prepare/enable reference?
When msm8660_get_rpm() returns -EPROBE_DEFER, returning directly skips
the rollback for the clk_bulk_prepare_enable() call made earlier. This
will leak the clock reference on every probe retry.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1780197411.git.github.com@herrie.org?part=2
next prev parent reply other threads:[~2026-05-31 4:34 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-30 13:59 [PATCH 0/3] clk: qcom: add MSM8x60 Multimedia Clock Controller Herman van Hazendonk
2026-05-30 13:59 ` Herman van Hazendonk
2026-05-30 14:00 ` [PATCH 0/2] thermal: qcom: add PM8901 PMIC temperature-alarm driver Herman van Hazendonk
2026-05-30 14:00 ` [PATCH 0/2] interconnect: qcom: add MSM8x60 NoC driver Herman van Hazendonk
2026-05-30 13:59 ` [PATCH 0/2] clk: qcom: add MSM8x60 LPASS Clock Controller Herman van Hazendonk
2026-05-30 13:58 ` [PATCH 1/3] dt-bindings: clock: qcom: add mmcc-msm8660 clock IDs Herman van Hazendonk
2026-05-31 15:39 ` Dmitry Baryshkov
2026-05-30 13:58 ` [PATCH 2/3] dt-bindings: reset: qcom: add mmcc-msm8660 reset IDs Herman van Hazendonk
2026-05-30 13:58 ` [PATCH 3/3] clk: qcom: add MSM8x60 MMCC driver Herman van Hazendonk
2026-05-30 13:59 ` [PATCH 1/2] dt-bindings: clock: qcom: add lcc-msm8660 LPASS clock IDs Herman van Hazendonk
2026-05-30 14:15 ` sashiko-bot
2026-05-30 13:59 ` [PATCH 2/2] clk: qcom: add MSM8x60 LCC (LPASS) driver Herman van Hazendonk
2026-05-30 14:25 ` sashiko-bot
2026-05-31 15:46 ` Dmitry Baryshkov
2026-05-30 14:00 ` [PATCH 1/2] dt-bindings: interconnect: qcom: add msm8660 fabric IDs Herman van Hazendonk
2026-05-30 14:00 ` [PATCH 2/2] interconnect: qcom: add MSM8x60 NoC driver Herman van Hazendonk
2026-05-30 14:14 ` sashiko-bot
2026-05-30 14:00 ` [PATCH 1/2] dt-bindings: interrupt-controller: qcom: add msm8660-mpm Herman van Hazendonk
2026-05-30 14:00 ` [PATCH 2/2] irqchip: add MSM8x60 MPM wakeup interrupt controller driver Herman van Hazendonk
2026-05-30 14:22 ` sashiko-bot
2026-05-30 14:00 ` [PATCH 1/2] dt-bindings: thermal: qcom: add pm8901-temp-alarm Herman van Hazendonk
2026-05-30 14:08 ` sashiko-bot
2026-05-30 20:48 ` Rob Herring (Arm)
2026-05-30 14:00 ` [PATCH 2/2] thermal: qcom: add PM8901 PMIC temperature-alarm driver Herman van Hazendonk
2026-05-30 14:16 ` sashiko-bot
2026-05-31 4:08 ` [PATCH v2 0/3] clk: qcom: add MSM8x60 LPASS Clock Controller Herman van Hazendonk
2026-05-31 4:09 ` [PATCH v2 1/3] dt-bindings: clock: qcom,lcc: add MSM8x60 family compatibles Herman van Hazendonk
2026-05-31 4:14 ` sashiko-bot
2026-05-31 7:58 ` Krzysztof Kozlowski
2026-05-31 4:09 ` [PATCH v2 2/3] dt-bindings: clock: qcom: add lcc-msm8660 LPASS clock IDs Herman van Hazendonk
2026-05-31 4:23 ` sashiko-bot
2026-05-31 4:09 ` [PATCH v2 3/3] clk: qcom: add MSM8x60 LCC (LPASS) driver Herman van Hazendonk
2026-05-31 4:33 ` sashiko-bot
2026-05-31 4:09 ` [PATCH v2 0/2] interconnect: qcom: add MSM8x60 NoC driver Herman van Hazendonk
2026-05-31 4:09 ` Herman van Hazendonk
2026-05-31 4:09 ` [PATCH v2 0/3] thermal: qcom: add PM8901 PMIC temperature-alarm driver Herman van Hazendonk
2026-05-31 4:09 ` [PATCH v2 1/2] dt-bindings: interconnect: qcom: add msm8660 fabric IDs Herman van Hazendonk
2026-05-31 8:00 ` Krzysztof Kozlowski
2026-05-31 4:09 ` [PATCH v2 2/2] interconnect: qcom: add MSM8x60 NoC driver Herman van Hazendonk
2026-05-31 4:34 ` sashiko-bot [this message]
2026-05-31 4:09 ` [PATCH v2 1/3] dt-bindings: mfd: qcom-pm8xxx: allow temp-alarm subnode Herman van Hazendonk
2026-05-31 7:59 ` Krzysztof Kozlowski
2026-05-31 4:09 ` [PATCH v2 2/3] dt-bindings: thermal: qcom: add pm8901-temp-alarm Herman van Hazendonk
2026-05-31 4:09 ` [PATCH v2 3/3] thermal: qcom: add PM8901 PMIC temperature-alarm driver Herman van Hazendonk
2026-05-31 4:41 ` sashiko-bot
2026-05-31 4:09 ` [PATCH v2 0/2] irqchip: add MSM8x60 MPM wakeup interrupt controller Herman van Hazendonk
2026-05-31 4:09 ` [PATCH v2 1/2] dt-bindings: interrupt-controller: qcom: add msm8660-mpm Herman van Hazendonk
2026-05-31 4:20 ` sashiko-bot
2026-05-31 8:01 ` Krzysztof Kozlowski
2026-05-31 4:09 ` [PATCH v2 2/2] irqchip: add MSM8x60 MPM wakeup interrupt controller driver Herman van Hazendonk
2026-05-31 4:32 ` sashiko-bot
2026-06-01 7:25 ` Sebastian Andrzej Siewior
2026-06-03 15:12 ` Thomas Gleixner
2026-05-31 15:36 ` [PATCH 0/2] clk: qcom: add MSM8x60 LPASS Clock Controller Dmitry Baryshkov
-- strict thread matches above, loose matches on Subject: below --
2026-06-04 18:43 [PATCH v2 0/2] interconnect: qcom: add MSM8x60 NoC driver Herman van Hazendonk
2026-06-04 18:44 ` [PATCH v2 2/2] " Herman van Hazendonk
2026-06-04 18:58 ` sashiko-bot
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=20260531043416.604C41F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=github.com@herrie.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 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.