Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Srinivas Kandagatla" <srinivas.kandagatla@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v10 1/3] dt-bindings: soundwire: qcom: Increase max data ports to 17
Date: Wed, 01 Jul 2026 16:43:45 +0000	[thread overview]
Message-ID: <20260701164345.938751F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701163115.3701298-2-srinivas.kandagatla@oss.qualcomm.com>

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

Pre-existing issues:
- [High] Incorrect search size in find_first_zero_bit prevents -EBUSY on port exhaustion and causes silent double-allocation of the highest port.
- [High] The dt-bindings now allow up to 17 SoundWire data ports, but the corresponding driver internal structures have a hardcoded limit of 15 DAIs, leading to a buffer overflow.
--

commit bfff7ab83551c0958297b1c39b25931747061203
Author: Sibi Sankar <sibi.sankar@oss.qualcomm.com>

dt-bindings: soundwire: qcom: Increase max data ports to 17

Bump the maxItems from 16 to 17 for all qcom,ports-* properties to
accommodate SoundWire controllers v3.1.0 with 17 data ports.

> diff --git a/Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml b/Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml
> index 9447a2f371b56..8e6973fa229c9 100644
> --- a/Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml
> +++ b/Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml
> @@ -90,7 +90,7 @@ properties:
>        or applicable for the respective data port.
>        More info in MIPI Alliance SoundWire 1.0 Specifications.
>      minItems: 3
> -    maxItems: 16
> +    maxItems: 17

[Severity: High]
This is a pre-existing issue, but does increasing the number of ports to 17
expose an out-of-bounds write in the qcom soundwire driver?

In drivers/soundwire/qcom.c, SWRM_MAX_DAIS is hardcoded to 15:

#define SWRM_MAX_DAIS						0xF

Which bounds the sruntime array in struct qcom_swrm_ctrl:

	struct sdw_stream_runtime *sruntime[SWRM_MAX_DAIS];

If a device is configured with 17 ports, will this lead to an out-of-bounds
write when setting up streams on the 16th or 17th port?

drivers/soundwire/qcom.c:qcom_swrm_set_sdw_stream() {
	...
	ctrl->sruntime[dai->id] = stream;
	...
}

[Severity: High]
This is a pre-existing issue, but the port exhaustion check in the driver
appears to have a logic error that could be impacted by changing port counts.

In drivers/soundwire/qcom.c:qcom_swrm_stream_alloc_ports():

	pn = find_first_zero_bit(port_mask, maxport);

	if (pn > maxport) {
		dev_err(ctrl->dev, "All ports busy\n");
		return -EBUSY;
	}
	set_bit(pn, port_mask);

Since find_first_zero_bit() returns the size parameter (maxport) if no zero
bits are found, the check if (pn > maxport) will be false when all ports
are busy.

Will this cause the driver to bypass the -EBUSY check and repeatedly assign
the highest port instead of handling resource exhaustion properly?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260701163115.3701298-1-srinivas.kandagatla@oss.qualcomm.com?part=1

  reply	other threads:[~2026-07-01 16:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 16:31 [PATCH v10 0/3] Enable ADSP and CDSP for Glymur SoC Srinivas Kandagatla
2026-07-01 16:31 ` [PATCH v10 1/3] dt-bindings: soundwire: qcom: Increase max data ports to 17 Srinivas Kandagatla
2026-07-01 16:43   ` sashiko-bot [this message]
2026-07-01 19:33     ` Srinivas Kandagatla
2026-07-02  6:12   ` Krzysztof Kozlowski
2026-07-01 16:31 ` [PATCH v10 2/3] arm64: dts: glymur: Add LPASS macro codecs and pinctrl Srinivas Kandagatla
2026-07-01 22:30   ` Dmitry Baryshkov
2026-07-01 16:31 ` [PATCH v10 3/3] arm64: dts: qcom: glymur-crd: add Audio sound card node Srinivas Kandagatla
2026-07-01 22:30   ` Dmitry Baryshkov
2026-07-02 17:02 ` (subset) [PATCH v10 0/3] Enable ADSP and CDSP for Glymur SoC Vinod Koul

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=20260701164345.938751F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=srinivas.kandagatla@oss.qualcomm.com \
    /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