Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hardeep Sharma" <hardeep.sharma@oss.qualcomm.com>
Cc: conor+dt@kernel.org, robh@kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v5 07/15] interconnect: qcom: Add Kuno interconnect provider driver
Date: Thu, 27 Aug 2026 18:23:22 +0000	[thread overview]
Message-ID: <20260827182322.7A1B01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827-kuno-soc-support-v5-7-6d47636a8f09@oss.qualcomm.com>

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

Pre-existing issues:
- [High] Dangling pointers in statically allocated `qcom_icc_node` structs cause Use-After-Free on driver rebind or deferred probe.
--

commit 247254381db99e8828d00f4e780472baac9636d1
Author: Hardeep Sharma <hardeep.sharma@oss.qualcomm.com>

interconnect: qcom: Add Kuno interconnect provider driver
    
This commit adds a new interconnect provider driver for the Qualcomm Kuno
SoC. It defines the interconnect nodes and BCM structures, and registers
the interconnect provider using the common RPMh probe and remove functions.

> diff --git a/drivers/interconnect/qcom/kuno.c b/drivers/interconnect/qcom/kuno.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/interconnect/qcom/kuno.c
> @@ -0,0 +1,988 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> + */
> +
> +#include <linux/device.h>
> +#include <linux/interconnect.h>
> +#include <linux/interconnect-provider.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +
> +#include <dt-bindings/interconnect/qcom,kuno.h>
> +
> +#include "bcm-voter.h"
> +#include "icc-rpmh.h"
> +
> +static struct qcom_icc_node qup0_core_slave = {
> +	.name = "qup0_core_slave",
> +	.channels = 1,
> +	.buswidth = 4,
> +	.num_links = 0,
> +};

[Severity: High]
This isn't a bug introduced by this patch, but does the use of statically
allocated nodes like qup0_core_slave in kuno.c create a risk of a dangling
pointer?

When the driver binds, qcom_icc_rpmh_probe() allocates dynamic icc_node
structures and caches them in the node field of these static definitions.

On driver unbind or deferred probe error paths, qcom_icc_rpmh_remove()
frees those structures via kfree(). However, the static pointers in the
qcom_icc_node arrays are never cleared to NULL.

If a privileged user unbinds and rebinds the driver via sysfs, or if a
deferred probe is triggered on startup, could the new probe call bypass the
if (!qn->node) check, reuse the freed pointer in icc_node_set_name() or
icc_node_add(), and result in memory corruption or a use-after-free?

[ ... ]

> +static struct platform_driver qnoc_driver = {
> +	.probe = qcom_icc_rpmh_probe,
> +	.remove = qcom_icc_rpmh_remove,
> +	.driver = {
> +		.name = "qnoc-kuno",
> +		.of_match_table = qnoc_of_match,
> +		.sync_state = icc_sync_state,
> +	},
> +};

[Severity: High]
This isn't a bug introduced by this patch, but since qnoc_driver registers
with qcom_icc_rpmh_probe and qcom_icc_rpmh_remove, does it inherit the
unbind and rebind issue described above?

Because qcom_icc_rpmh_remove() does not clear the cached pointers from the
static node arrays provided by this driver, could a deferred probe or sysfs
rebind result in dereferencing freed memory?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260827-kuno-soc-support-v5-0-6d47636a8f09@oss.qualcomm.com?part=7

  reply	other threads:[~2026-08-27 18:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 17:51 [PATCH v5 00/15] Add initial support for Qualcomm Kuno SoC Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 01/15] soc: qcom: geni-se: allow selection on 32-bit ARM Qualcomm SoCs Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 02/15] dt-bindings: power: rpmpd: Document Kuno RPMh power domains Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 03/15] pmdomain: qcom: rpmhpd: Add power domains for Kuno Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 04/15] dt-bindings: clock: qcom,rpmhcc: Add Kuno RPMh clock controller Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 05/15] clk: qcom: clk-rpmh: Add support for Kuno RPMh clocks Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 06/15] dt-bindings: interconnect: Add Qualcomm Kuno NoC Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 07/15] interconnect: qcom: Add Kuno interconnect provider driver Hardeep Sharma
2026-08-27 18:23   ` sashiko-bot [this message]
2026-08-27 17:51 ` [PATCH v5 08/15] dt-bindings: pinctrl: qcom: Add Kuno TLMM Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 09/15] pinctrl: qcom: Add Kuno pinctrl driver Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 10/15] dt-bindings: clock: qcom: Add Kuno Global Clock Controller Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 11/15] clk: qcom: Add Global Clock Controller driver for Kuno Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 12/15] dt-bindings: interrupt-controller: qcom,pdc: Add Kuno compatible string Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 13/15] dt-bindings: firmware: qcom,scm: Document SCM on Kuno SoC Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 14/15] dt-bindings: arm: qcom: Document Kuno IDP board Hardeep Sharma
2026-08-27 17:51 ` [PATCH v5 15/15] ARM: dts: qcom: Add initial device tree for Kuno SoC Hardeep Sharma
2026-08-27 18:09   ` 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=20260827182322.7A1B01F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hardeep.sharma@oss.qualcomm.com \
    --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