[PATCH v3 0/5] soundwire: Fix bandwidth leak in multi-link aggregation failure
From: Bard Liao
Date: Thu Nov 12 2026 - 09:52:52 EST
The existing code only copies the params from the first link to the
bus params, but it doesn't copy the bandwidth from the other links.
This can lead to a bandwidth leak when multi-link aggregation fails.
Fix this by saving a snapshot of each bus's parameters before making
any modifications.
Changes in v3:
- Add Fixes and Cc stable tags to "Select the correct runtime for lane
allocation".
- Fix bandwidth leak in multi-link aggregation failure:
- Reset the lanes of the stream in the rollback path so they match
the restored lane_used_bandwidth. This is skipped when the
parameters were not updated.
- Keep curr_bank and next_bank when restoring the snapshot, as the
register bank may already have been switched when the failure
happens.
- Update the commit message accordingly.
Changes in v2:
- Fix lane and rate group handling in the generic bandwidth allocation
that the rollback depends on:
- Pass the prepare/deprepare context to compute_params().
- Select the runtime of the stream being prepared for lane allocation
instead of the first runtime on the bus, which could be an already
running stream.
- Include the current stream in the group and port computation when
it is prepared again from the DEPREPARED state.
- Reset the lane of the stream being prepared to 0 when no multi-lane
is selected, so the lane assignment matches the restored
lane_used_bandwidth.
Bard Liao (4):
soundwire: move lane bandwidth into bus params
soundwire: Pass prepare context to parameter computation
soundwire: Select the correct runtime for lane allocation
soundwire: Include the current stream when preparing again
David Lin (1):
soundwire: stream: Fix bandwidth leak in multi-link aggregation
failure
drivers/soundwire/amd_manager.c | 3 +-
drivers/soundwire/bus.h | 3 +
.../soundwire/generic_bandwidth_allocation.c | 81 ++++++++++++++-----
drivers/soundwire/qcom.c | 3 +-
drivers/soundwire/stream.c | 48 +++++++++--
include/linux/soundwire/sdw.h | 13 +--
6 files changed, 115 insertions(+), 36 deletions(-)
--
2.43.0