Repository navigation
Conversation
lane_used_bandwidth is used to store the used bandwidth for each lane. When we restore the bus->params, the lane_used_bandwidth value will not be restored in current code. Move it to sdw_bus_params to fix the issue. Fixes: 366fd59 ("soundwire: generic_bandwidth_allocation: add lane in sdw_group_params") Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
When preparing a multi-link aggregation stream, a failure on a subsequent link during _sdw_prepare_stream() causes the stream preparation to fail. However, the bandwidth allocated on the preceding successful links is never released, causing a cumulative bandwidth leak. Fix this by saving a snapshot of each bus's parameters before making any modifications. In case of failure, we iterate through the stream's master list and restore each bus to its original parameter state, ensuring an atomic rollback and preventing any bandwidth leaks. Signed-off-by: David Lin <david.lin@intel.com>
bardliao
requested review from
davidlin923,
plbossart and
ujfalusi
and
a balanced review from Copilot
October 13, 2026 05:07
bardliao
requested review from
jack-cy-yu,
oder-chiou and
shumingfan
as code owners
October 13, 2026 05:07
There was a problem hiding this comment.
🟡 Changes recommended
Rollback leaves port-lane state inconsistent and can desynchronize software bank state from hardware.
1 open finding
What changed in this PR
Fixes SoundWire bandwidth accounting rollback when multi-link stream preparation fails.
Changes:
- Snapshots and restores parameters for every master bus.
- Moves per-lane bandwidth accounting into
sdw_bus_params. - Updates allocation and depreparation paths for the relocated accounting.
| File | Description |
|---|---|
include/linux/soundwire/sdw.h |
Relocates per-lane bandwidth state. |
drivers/soundwire/stream.c |
Adds multi-bus rollback handling. |
drivers/soundwire/generic_bandwidth_allocation.c |
Uses relocated lane accounting. |
drivers/soundwire/bus.h |
Adds per-master parameter snapshots. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
davidlin923
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

When preparing a multi-link aggregation stream, a failure on a subsequent link during _sdw_prepare_stream() causes the stream preparation to fail. However, the bandwidth allocated on the preceding successful links is never released, causing a cumulative bandwidth leak.
Fix this by restoring the parameters for all buses.