summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>2026-07-01 20:30:05 +0100
committerVinod Koul <vkoul@kernel.org>2026-07-02 21:56:49 +0530
commit6ccec91c3535b07310e12d32fe9c67ff8d31d965 (patch)
tree04f2e8e9b4d627096efb7b097aef94762e5c7d11
parentb496bb56b418788aa8625950e94206abe7282e18 (diff)
downloadlinux-6ccec91c3535b07310e12d32fe9c67ff8d31d965.tar.gz
linux-6ccec91c3535b07310e12d32fe9c67ff8d31d965.zip
soundwire: qcom: Fix port exhaustion check in stream_alloc_ports
find_first_zero_bit(mask, n) returns n (not n+1) when all bits are set, so the guard `pn > maxport` is never true on exhaustion. The driver would silently call set_bit(maxport, port_mask) and assign the out-of-range port instead of returning -EBUSY. Fix the comparison to `pn >= maxport`. Fixes: 02efb49aa805 ("soundwire: qcom: add support for SoundWire controller") Reported-by: sashiko-bot <sashiko-bot@kernel.org> Assisted-by: Claude Sonnet 4.6 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Link: https://patch.msgid.link/20260701193006.4113-2-srinivas.kandagatla@oss.qualcomm.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
-rw-r--r--drivers/soundwire/qcom.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 3d8f5a81eff1..b288218f64b4 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1271,7 +1271,7 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
else
pn = find_first_zero_bit(port_mask, maxport);
- if (pn > maxport) {
+ if (pn >= maxport) {
dev_err(ctrl->dev, "All ports busy\n");
return -EBUSY;
}