Skip to content

FROMLIST: soundwire: qcom: Fix off-by-one error in port exhaustion check - #2409

Open
Christopher Obbard (obbardc) wants to merge 2 commits into
qualcomm-linux:tech/mm/audio/allfrom
obbardc:wip/obbardc/soundwire-qcom-fix-port-off-by-one
Open

Christopher Obbard (obbardc) wants to merge 2 commits into
qualcomm-linux:tech/mm/audio/allfrom
obbardc:wip/obbardc/soundwire-qcom-fix-port-off-by-one

Conversation

@obbardc

@obbardc Christopher Obbard (obbardc) commented Nov 26, 2026 •

Copy link
Copy Markdown

Qualcomm SoundWire master ports are indexed from 1, with bit 0 of
port_mask reserved. Valid port numbers therefore range from 1 to
maxport.

Commit 6ccec91 ("soundwire: qcom: Fix port exhaustion check in
stream_alloc_ports") changed the port exhaustion check from
pn > maxport to pn >= maxport which rejects the last valid port.

On RB3gen2 (QCS6490), two WSA883x speaker amplifiers are connected
to swr2, which has qcom,dout-ports = <6> and qcom,din-ports = <2>
(8 ports). Each amplifier uses one port for playback and another for
voltage and current sensing (VISENSE). The right amplifier's
qcom,port-mapping is <4 5 6 8>, so its VISENSE port is master port 8,
which is rejected by the new check.

Since all ports in a SoundWire stream are allocated together during
hw_params, this causes the stream to fail with:

qcom-soundwire 3250000.soundwire: All ports busy

The -EBUSY propagates through hw_params, preventing speaker playback.
Disabling VISENSE works around the issue. Speaker protection is not
enabled on this device in upstream, but with AudioReach userspace the
userspace PAL mixer paths enable VISENSE on every speaker stream, so a
mixer change alone does not avoid the failure.

The original fix addressed an exhaustion check that could never
trigger because find_first_zero_bit() returns maxport when all
searched bits are set. Include the reserved bit 0 in the search so
exhaustion returns maxport + 1 and restore the pn > maxport check.

Tested on RB3gen2 with a v7.4-rc3 based kernel and AudioReach
userspace: with the stock PAL mixer paths, which enable VISENSE on
both amplifiers, speaker playback through the PAL speaker sink is
audible and no longer fails with "All ports busy".

Fixes: 6ccec91 ("soundwire: qcom: Fix port exhaustion check in stream_alloc_ports")
Cc: stable@vger.kernel.org
Signed-off-by: Christopher Obbard chris.obbard@oss.qualcomm.com
Link: https://lore.kernel.org/all/20261126-wip-obbardc-soundwire-qcom-fix-port-off-by-one-v2-1-c424edf85968@oss.qualcomm.com/

Notes:

@qswat-orbit-external

Copy link
Copy Markdown

Change Requests Validation Check

No CR numbers found in the pull request description.

Please add CR numbers in the format: CRs-fixed: {number} (one per line).

Example:

CRs-fixed: 12345
CRs-fixed: 67890

@qcomlnxci
qcomlnxci requested review from a team, PrasadKumpatla and mohsRafi and removed request for a team November 26, 2026 09:04
@obbardc

Copy link
Copy Markdown
Author

I am not sure how to solve the above comment. Please assist.

@qswat-orbit-external

Copy link
Copy Markdown

Change Requests Validation Check

No CR numbers found in the pull request description.

Please add CR numbers in the format: CRs-fixed: {number} (one per line).

Example:

CRs-fixed: 12345
CRs-fixed: 67890

@qlijarvis

Copy link
Copy Markdown

PR #2409 — validate-patch

PR: #2409

Verdict Issues Detailed Report
✅ 0 Full report

Final Summary

  1. Lore link present: Yes — both commits have correct lore.kernel.org links in Link: trailers
  2. Lore link matches PR commits: Yes — both diffs are identical to their lore sources; commit messages preserved verbatim
  3. Upstream patch status:
    • Commit 1/2: ✅ Upstreamed — Applied by Vinod Koul as d9ea256 in soundwire/next
    • Commit 2/2: ⏳ In review — Posted Nov 26 with Reviewed-by from Srinivas Kandagatla; awaiting maintainer merge
  4. PR present in qcom-next/topics: Partial - 1/2 commit(s) only have partial integration evidence
Verdict: ✅ — click to expand

🔍 Patch Validation

PR: #2409 - soundwire: qcom: Prevent pconfig buffer overflow and fix off-by-one error
Upstream commits:


Commit 1/2: FROMLIST: soundwire: qcom: Prevent pconfig buffer overflow

Check Status Note
Subject matches upstream ✅ Identical (FROMLIST prefix added correctly)
Body preserves rationale ✅ Full commit message preserved verbatim
Fixes tag present/correct N/A No Fixes tag in upstream (not a regression fix)
Authorship preserved ✅ From: Lee Jones matches lore author; Lee Jones Signed-off-by present
Backport note (if applicable) N/A FROMLIST commit, not a backport
Co-developed-by used correctly ✅ Not used

Diff comparison:

File Status Notes
drivers/soundwire/qcom.c ✅ Identical to lore patch - all hunks match exactly

Upstream patch status: ✅ ACKed — Applied by Vinod Koul (soundwire maintainer) as commit d9ea256ee889 in soundwire/next tree. Thread shows "Applied, thanks!" from maintainer with commit SHA listed.


Commit 2/2: FROMLIST: soundwire: qcom: Fix off-by-one error in port exhaustion check

Check Status Note
Subject matches upstream ✅ Identical (FROMLIST prefix added correctly)
Body preserves rationale ✅ Full commit message preserved verbatim including detailed explanation
Fixes tag present/correct ✅ Fixes: 6ccec91c3535 present and correct
Authorship preserved ✅ From: Christopher Obbard matches lore author; Christopher Obbard Signed-off-by present
Backport note (if applicable) N/A FROMLIST commit, not a backport
Co-developed-by used correctly ✅ Not used

Diff comparison:

File Status Notes
drivers/soundwire/qcom.c ✅ Identical to lore patch - all hunks match exactly (2 lines changed: find_first_zero_bit maxport+1, pn > maxport)

Upstream patch status: ⏳ Decision Pending — Posted Nov 26, 2026 (v2). Has Reviewed-by: Srinivas Kandagatla from Qualcomm maintainer. No "Applied" confirmation yet in thread, but review signal is positive. Patch is very recent (same day as analysis).


Integration Presence (from integration_presence_report.md)

Commit qcom-next topics Final Status
1/2 ❌ missing ✅ present at d9ea256 ✅ Present
2/2 ❌ missing ⚠️ partial evidence ⚠️ Partial

Overall integration status: Partial - Commit 1/2 is fully present in topics branch (exact patch-id match at d9ea256). Commit 2/2 shows only partial integration evidence.


Issues Found

None. Both commits are faithful representations of their upstream lore patches with correct FROMLIST prefixes, preserved authorship, complete commit messages, and identical diffs.


Verdict

Merge as-is. Both patches are correctly formatted FROMLIST commits that faithfully represent their upstream lore sources. Commit 1/2 has been accepted upstream (applied to soundwire/next as d9ea256) and is already present in the topics branch. Commit 2/2 is under active review with positive maintainer feedback (Reviewed-by from Srinivas Kandagatla) and is expected to be merged soon.


Final Summary

  1. Lore link present: Yes — both commits have correct lore.kernel.org links in Link: trailers
  2. Lore link matches PR commits: Yes — both diffs are identical to their lore sources; commit messages preserved verbatim
  3. Upstream patch status:
    • Commit 1/2: ✅ Upstreamed — Applied by Vinod Koul as d9ea256 in soundwire/next
    • Commit 2/2: ⏳ In review — Posted Nov 26 with Reviewed-by from Srinivas Kandagatla; awaiting maintainer merge
  4. PR present in qcom-next/topics: Partial — Commit 1/2 fully present in topics (d9ea256); Commit 2/2 shows partial integration evidence (likely in-flight)

Deterministic Integration Presence

Integration Presence Report

This report is generated by Jarvis before validate-patch runs.
It is the authoritative source for whether PR changes are already present
in qcom-next or in the kernel topic branches.

Kernel repo: /local/mnt/workspace/sgaud/Qgenie/image_pipeline/kernel
qcom-next ref: 1843874b4356d1203ebd83d5ebfc24d45aa35f1d
topics remote: topics -> https://github.com/qualcomm-linux/kernel-topics
topics fetch: fetched

Commit Subject qcom-next topics Final
1/2 [PATCH 1/2] FROMLIST: soundwire: qcom: Prevent pconfig buffer missing - no subject, patch-id, or full tree-content match found present - exact patch-id match at d9ea256 present
2/2 [PATCH 2/2] FROMLIST: soundwire: qcom: Fix off-by-one error in port missing - no subject, patch-id, or full tree-content match found partial - subject or partial tree evidence found, but full change was not verified partial

Final Status

overall_status: PARTIAL
present_commits: 1/2
partial_commits: 1/2
missing_commits: 0/2
topics_checked_for_commits: 2/2
final_summary: PR present in qcom-next/topics: Partial - 1/2 commit(s) only have partial integration evidence

@qlijarvis

Copy link
Copy Markdown

PR #2409 — checker-log-analyzer

PR: #2409
Checker run: https://github.com/qualcomm-linux/kernel-config/actions/runs/45788530488

Checker Result Summary
Checker Result Summary
checkpatch ✅ All commits pass style checks
dt-binding-check ⏭️ No DT binding changes
dtb-check ⏭️ No devicetree changes
sparse-check ✅ No sparse warnings
check-uapi-headers ✅ No UAPI changes
check-patch-compliance ❌ Link verification failed for 1 commit
tag-check N/A Not required for qcom-next branch

Detailed report: Full report

Checker analysis — click to expand

🤖 CI Checker Analysis (checker-log-analyzer)

PR: #2409 - FROMLIST: soundwire: qcom fixes
Source: https://github.com/qualcomm-linux/kernel-config/actions/runs/45788530488
Target branch: qcom-next

Checker Result Summary
checkpatch ✅ All commits pass style checks
dt-binding-check ⏭️ No DT binding changes
dtb-check ⏭️ No devicetree changes
sparse-check ✅ No sparse warnings
check-uapi-headers ✅ No UAPI changes
check-patch-compliance ❌ Link verification failed for 1 commit
tag-check N/A Not required for qcom-next branch

❌ check-patch-compliance

Root cause: The Link: URL for the first commit cannot be fetched by b4, likely because the patch has not been posted to the mailing list yet or the message-ID is incorrect.

Failure details:

Checking commit: FROMLIST: soundwire: qcom: Prevent pconfig buffer overflow in qcom_swrm_stream_alloc_ports()
Something seems wrong with the provided link. Please verify it
Try below command to run locally-
b4 am --single-message -C -l -3 https://patch.msgid.link/20261123075522.405347-7-lee@kernel.org
https://lore.kernel.org/all/20261123075522.405347-7-lee@kernel.org/

Analysis:

The first commit has two Link: lines in the commit message:

Link: https://patch.msgid.link/20261123075522.405347-7-lee@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/all/20261123075522.405347-7-lee@kernel.org/

The checker attempts to fetch the patch from lore using b4, but the URL returns no content. This could be because:

  1. The patch hasn't been posted yet — The date in the message-ID is 20261123 (November 23, 2026), which may be in the future relative to when the patch was actually posted, or the patch is still pending on the mailing list.

  2. Duplicate Link: lines — Having two Link: lines is unusual. The second Signed-off-by: Vinod Koul between them suggests this may be a backport or cherry-pick from a maintainer tree where Vinod Koul applied the patch. The duplicate Link: should be removed.

  3. Wrong message-ID — The message-ID 20261123075522.405347-7-lee@kernel.org may be incorrect or the patch may have been posted with a different message-ID.

Fix:

Option 1 (if the patch is already merged upstream): Change the prefix from FROMLIST: to UPSTREAM: or FROMGIT: and update the Link: to point to the commit in Linus's tree or the maintainer's tree:

git rebase -i <base_sha>   # mark commit as 'edit'
git commit --amend
# Change subject to: UPSTREAM: soundwire: qcom: Prevent pconfig buffer...
# Update commit body to have a single Link: pointing to the upstream commit
git rebase --continue

Option 2 (if the patch is genuinely on FROMLIST): Verify the correct lore URL by searching lore.kernel.org for the patch subject, then update the Link: line to the correct message-ID. Remove the duplicate Link: line and the extra Signed-off-by: Vinod Koul if it's not the original author.

Option 3 (if the patch hasn't been posted yet): Change the prefix to PENDING: (though note that check-patch-compliance will still fail for PENDING: commits — this is a known checker limitation for vendor-only or not-yet-posted commits).

Reproduce locally:

# Test if b4 can fetch the patch
b4 am --single-message -C -l -3 https://lore.kernel.org/all/20261123075522.405347-7-lee@kernel.org/

# If it fails, search lore for the correct message-ID
curl -s "https://lore.kernel.org/all/?q=soundwire+qcom+Prevent+pconfig+buffer+overflow" | grep -i "lee@kernel.org"

Verdict

1 blocker to fix before merge:

The first commit's Link: URL cannot be verified by the checker. This needs to be resolved by either:

  • Updating the Link: to a valid, fetchable lore URL
  • Changing the prefix to UPSTREAM:/FROMGIT: if the patch is already merged
  • Accepting that FROMLIST: commits with not-yet-posted or inaccessible links will fail this checker

The second commit passed all checks. All other checkers (checkpatch, sparse, dtb-check, dt-binding-check, check-uapi-headers) passed or were skipped appropriately.

@obbardc
Christopher Obbard (obbardc) force-pushed the wip/obbardc/soundwire-qcom-fix-port-off-by-one branch from cd968ac to 6bddfd4 Compare November 26, 2026 12:09
@qswat-orbit-external

Copy link
Copy Markdown

Change Requests Validation Check

No CR numbers found in the pull request description.

Please add CR numbers in the format: CRs-fixed: {number} (one per line).

Example:

CRs-fixed: 12345
CRs-fixed: 67890

@qcomlnxci
qcomlnxci requested a review from a team November 26, 2026 12:10
@qlijarvis

Copy link
Copy Markdown

PR #2409 — validate-patch

PR: #2409

Verdict Issues Detailed Report
✅ 0 Full report

Final Summary

  1. Lore link present: Yes — both commits have proper upstream links (git tree for FROMGIT, lore.kernel.org for FROMLIST)

  2. Lore link matches PR commits: Yes — commit 1/2 matches git tree commit d9ea256; commit 2/2 matches lore v2 posting with only contextual line number differences due to commit 1/2 being applied first

  3. Upstream patch status:

    • Commit 1/2: ✅ Merged into soundwire/next (d9ea256) on 2026-11-23
    • Commit 2/2: ⏳ In review — posted 2026-11-26, received Reviewed-by: from Srinivas Kandagatla same day, awaiting maintainer merge
  4. PR present in qcom-next/topics: Partial - 1/2 commit(s) only have partial integration evidence

    • Commit 1/2: ✅ Present in topics (all added lines verified)
    • Commit 2/2: ⚠️ Partial presence in topics (subject or partial tree evidence found, but full change not verified)
Verdict: ✅ — click to expand

🔍 Patch Validation

PR: kernel-topics#2409 - soundwire: qcom fixes (2 commits)
Upstream commits:

Verdict: ✅ PASS


Commit 1/2: FROMGIT: soundwire: qcom: Prevent pconfig buffer overflow

Commit Message

Check Status Note
Subject matches upstream ✅ Subject correctly prefixed with FROMGIT:
Body preserves rationale ✅ Full commit message preserved from upstream
Fixes tag present/correct N/A No Fixes tag in original upstream commit
Authorship preserved ✅ From: Lee Jones <lee@kernel.org> matches upstream author
Backport note ✅ Git tree link present: Link: https://git.kernel.org/...soundwire.git/commit/?h=next&id=d9ea256ee889

Diff

File Status Notes
drivers/soundwire/qcom.c ✅ Diff matches upstream commit d9ea256 from soundwire/next tree

Upstream Status

✅ Merged — Commit d9ea256 merged into soundwire maintainer tree (next branch) by Vinod Koul on 2026-11-23.


Commit 2/2: FROMLIST: soundwire: qcom: Fix off-by-one error in port exhaustion check

Commit Message

Check Status Note
Subject matches upstream ✅ Subject correctly prefixed with FROMLIST: and matches lore posting
Body preserves rationale ✅ Complete commit message preserved verbatim from lore v2 posting
Fixes tag present/correct ✅ Fixes: 6ccec91c3535 present and correct
Authorship preserved ✅ From: Christopher Obbard matches lore author; FROMLIST: allows submitter as author
Backport note N/A Not a backport; this is a FROMLIST: commit (posted to mailing list, not yet merged)

Diff

File Status Notes
drivers/soundwire/qcom.c ✅ Diff is identical to lore v2 patch; only difference is line numbers (1658 vs 1461) due to commit 1/2 being applied first

Diff comparison details:

  • Lore patch applies at line 1461 (based on soundwire/next at d9ea256)
  • PR patch applies at line 1658 (after commit 1/2 which adds context)
  • Code changes are semantically identical:
    • find_first_zero_bit(port_mask, maxport) → find_first_zero_bit(port_mask, maxport + 1)
    • if (pn >= maxport || nports >= maxport) → if (pn > maxport || nports >= maxport)

Upstream Status

⏳ In Review — Posted to linux-sound@vger.kernel.org on 2026-11-26 (v2). Received Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> on 2026-11-26. Awaiting merge by maintainer Vinod Koul.


Issues

None. Both commits are correctly formatted and faithful to their upstream sources.


Verdict

Merge as-is. Both commits are correctly attributed, properly prefixed (FROMGIT: and FROMLIST:), and the diffs match their upstream sources. Commit 1/2 is already merged in the soundwire maintainer tree. Commit 2/2 has received maintainer review approval and is awaiting merge.


Final Summary

  1. Lore link present: Yes — both commits have proper upstream links (git tree for FROMGIT, lore.kernel.org for FROMLIST)

  2. Lore link matches PR commits: Yes — commit 1/2 matches git tree commit d9ea256; commit 2/2 matches lore v2 posting with only contextual line number differences due to commit 1/2 being applied first

  3. Upstream patch status:

    • Commit 1/2: ✅ Merged into soundwire/next (d9ea256) on 2026-11-23
    • Commit 2/2: ⏳ In review — posted 2026-11-26, received Reviewed-by: from Srinivas Kandagatla same day, awaiting maintainer merge
  4. PR present in qcom-next/topics: Partial — per integration_presence_report.md:

    • Commit 1/2: ✅ Present in topics (all added lines verified)
    • Commit 2/2: ⚠️ Partial presence in topics (subject or partial tree evidence found, but full change not verified)

Deterministic Integration Presence

Integration Presence Report

This report is generated by Jarvis before validate-patch runs.
It is the authoritative source for whether PR changes are already present
in qcom-next or in the kernel topic branches.

Kernel repo: /local/mnt/workspace/sgaud/Qgenie/image_pipeline/kernel
qcom-next ref: 1843874b4356d1203ebd83d5ebfc24d45aa35f1d
topics remote: topics -> https://github.com/qualcomm-linux/kernel-topics
topics fetch: fetched

Commit Subject qcom-next topics Final
1/2 [PATCH 1/2] FROMGIT: soundwire: qcom: Prevent pconfig buffer overflow missing - no subject, patch-id, or full tree-content match found present - all checked added lines are present present
2/2 [PATCH 2/2] FROMLIST: soundwire: qcom: Fix off-by-one error in port missing - no subject, patch-id, or full tree-content match found partial - subject or partial tree evidence found, but full change was not verified partial

Final Status

overall_status: PARTIAL
present_commits: 1/2
partial_commits: 1/2
missing_commits: 0/2
topics_checked_for_commits: 2/2
final_summary: PR present in qcom-next/topics: Partial - 1/2 commit(s) only have partial integration evidence

@qlijarvis

Copy link
Copy Markdown

PR #2409 — checker-log-analyzer

PR: #2409
Checker run: https://github.com/qualcomm-linux/kernel-config/actions/runs/45817173073

Checker Result Summary
Checker Result Summary
checkpatch ❌ 1 warning: duplicate signature in commit 6bddfd4
dt-binding-check ⏭️ No DT binding changes
dtb-check ⏭️ No devicetree changes
sparse-check ✅ Passed
check-uapi-headers ✅ Passed
check-patch-compliance ❌ b4 fetch failed for commit 28a1c39
tag-check ✅ Both commits have valid prefixes (FROMGIT:, FROMLIST:)

Detailed report: Full report

Checker analysis — click to expand

🤖 CI Checker Analysis (checker-log-analyzer)

PR: #2409 - soundwire: qcom: Fix off-by-one error in port exhaustion check
Source: https://github.com/qualcomm-linux/kernel-config/actions/runs/45817173073
Target branch: tech/mm/audio/all (kernel-topics)

Checker Result Summary
checkpatch ❌ 1 warning: duplicate signature in commit 6bddfd4
dt-binding-check ⏭️ No DT binding changes
dtb-check ⏭️ No devicetree changes
sparse-check ✅ Passed
check-uapi-headers ✅ Passed
check-patch-compliance ❌ b4 fetch failed for commit 28a1c39
tag-check ✅ Both commits have valid prefixes (FROMGIT:, FROMLIST:)

❌ checkpatch

Root cause: Commit 6bddfd4 has a duplicate Signed-off-by: trailer for the patch author.

Failure details:

Commit 6bddfd4dbf1f ("FROMLIST: soundwire: qcom: Fix off-by-one error in port exhaustion check")
WARNING: Duplicate signature
#47: 
Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>

6bddfd4dbf1fd9e56d6d4e6852ff9f0006da0a7a total: 0 errors, 1 warnings, 0 checks, 11 lines checked

The commit message contains two identical Signed-off-by: lines for Christopher Obbard. The first appears after the Fixes: and Cc: tags, and the second appears after the Link: tag.

Fix: Remove one of the duplicate Signed-off-by: lines.

git rebase -i <base_sha>   # mark commit 6bddfd4d as 'edit'
git commit --amend         # edit commit message to remove duplicate Signed-off-by
git rebase --continue

The correct trailer order should be:

Fixes: 6ccec91c3535 ("...")
Cc: stable@vger.kernel.org
Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
Link: https://lore.kernel.org/...

Reproduce locally:

./scripts/checkpatch.pl --strict --ignore FILE_PATH_CHANGES --git <base>..<head>

❌ check-patch-compliance

Root cause: b4 failed to fetch the lore patch for commit 28a1c39 (FROMGIT commit).

Failure details:

Checking commit: FROMGIT: soundwire: qcom: Prevent pconfig buffer overflow in qcom_swrm_stream_alloc_ports()
Something seems wrong with the provided link. Please verify it
Try below command to run locally-
b4 am --single-message -C -l -3 https://patch.msgid.link/20261123075522.405347-7-lee@kernel.org
https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire.git/commit/?h=next&id=d9ea256ee889f3db9f0bd07ce5d114ce92e31b4f

Analysis: This commit is tagged as FROMGIT: (taken from a maintainer tree) and includes two Link: tags:

  1. Link: https://patch.msgid.link/20261123075522.405347-7-lee@kernel.org (lore patch)
  2. Link: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire.git/commit/?h=next&id=d9ea256ee889f3db9f0bd07ce5d114ce92e31b4f (git commit)

The checker attempts to fetch the lore link with b4 but fails. This could be:

  • A network/timing issue (the patch was posted on 2026-11-23, very recent)
  • The lore archive hasn't indexed it yet
  • The message-ID format is not yet available

Fix: This is likely a transient issue. The commit is already in the maintainer's tree (as evidenced by the git.kernel.org link and the FROMGIT: prefix). Options:

  1. Re-trigger CI — the lore archive may have indexed the patch by now

  2. Verify the link manually:

    b4 am --single-message -C -l -3 https://patch.msgid.link/20261123075522.405347-7-lee@kernel.org

    If b4 succeeds locally, re-trigger CI. If it still fails, the patch may not be in lore yet.

  3. Alternative: Since this is a FROMGIT: commit (already merged into the maintainer tree), the lore link is supplementary. The git.kernel.org link proves the commit exists upstream. If the lore link continues to fail, consider whether it's strictly necessary for a FROMGIT: commit.

Note: The second commit (6bddfd4, FROMLIST:) passed the link check, so the checker infrastructure is working — this is specific to the first commit's lore link.


Verdict

2 blockers to fix before merge:

  1. checkpatch: Remove duplicate Signed-off-by: in commit 6bddfd4
  2. check-patch-compliance: Verify the lore link for commit 28a1c39 is accessible, or re-trigger CI

The duplicate signature is a definite fix. The check-patch-compliance failure may resolve on re-trigger if the lore archive has indexed the patch. If it persists and the commit is confirmed to be in the maintainer tree (which the git.kernel.org link proves), this may be acceptable for a FROMGIT: commit.

…m_stream_alloc_ports()

qcom_swrm_stream_alloc_ports() allocates the pconfig array with
ctrl->nports elements, but only checks that the assigned port number pn
is below maxport.  When multiple slave ports map to the same master port
via m_port_map or the stream requests more slave ports than
ctrl->nports, nports increments past ctrl->nports and writes out of
bounds of pconfig.

Verify that nports is less than maxport before writing to
pconfig[nports], and clear only the port_mask bits newly allocated
during the loop before returning -EBUSY.

Closes: https://sashiko.dev/#/bug/linux-543ea0c0-a6e5-4b03-a041-ea0a760802c1
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/linux-arm-msm/20261123075522.405347-7-lee@kernel.org/
Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
Qualcomm SoundWire master ports are indexed from 1, with bit 0 of
port_mask reserved. Valid port numbers therefore range from 1 to
maxport.

Commit 6ccec91 ("soundwire: qcom: Fix port exhaustion check in
stream_alloc_ports") changed the port exhaustion check from
pn > maxport to pn >= maxport which rejects the last valid port.

On RB3gen2 (QCS6490), two WSA883x speaker amplifiers are connected
to swr2, which has qcom,dout-ports = <6> and qcom,din-ports = <2>
(8 ports). Each amplifier uses one port for playback and another for
voltage and current sensing (VISENSE). The right amplifier's
qcom,port-mapping is <4 5 6 8>, so its VISENSE port is master port 8,
which is rejected by the new check.

Since all ports in a SoundWire stream are allocated together during
hw_params, this causes the stream to fail with:

    qcom-soundwire 3250000.soundwire: All ports busy

The -EBUSY propagates through hw_params, preventing speaker playback.
Disabling VISENSE works around the issue. Speaker protection is not
enabled on this device in upstream, but with AudioReach userspace the
userspace PAL mixer paths enable VISENSE on every speaker stream, so a
mixer change alone does not avoid the failure.

The original fix addressed an exhaustion check that could never
trigger because find_first_zero_bit() returns maxport when all
searched bits are set. Include the reserved bit 0 in the search so
exhaustion returns maxport + 1 and restore the pn > maxport check.

Tested on RB3gen2 with a v7.4-rc3 based kernel and AudioReach
userspace: with the stock PAL mixer paths, which enable VISENSE on
both amplifiers, speaker playback through the PAL speaker sink is
audible and no longer fails with "All ports busy".

Fixes: 6ccec91 ("soundwire: qcom: Fix port exhaustion check in stream_alloc_ports")
Cc: stable@vger.kernel.org
Signed-off-by: Christopher Obbard <chris.obbard@oss.qualcomm.com>
Link: https://lore.kernel.org/all/20261126-wip-obbardc-soundwire-qcom-fix-port-off-by-one-v2-1-c424edf85968@oss.qualcomm.com/
@obbardc
Christopher Obbard (obbardc) force-pushed the wip/obbardc/soundwire-qcom-fix-port-off-by-one branch from 6bddfd4 to 048de97 Compare November 26, 2026 14:02
@qswat-orbit-external

Copy link
Copy Markdown

Change Requests Validation Check

No CR numbers found in the pull request description.

Please add CR numbers in the format: CRs-fixed: {number} (one per line).

Example:

CRs-fixed: 12345
CRs-fixed: 67890

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants