soundwire: stream: Fix bandwidth leak in multi-link aggregation failure - #5964
Open
davidlin923 wants to merge 1 commit into
Open
davidlin923 wants to merge 1 commit into
davidlin923 wants to merge 1 commit into
Conversation
davidlin923
requested review from
jack-cy-yu,
oder-chiou and
shumingfan
as code owners
October 2, 2026 03:26
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Rollback remains incorrect for disabled streams, later preparation phases, asynchronous-rate failures, and multi-lane accounting.
Review effort: Balanced
Findings: 1
What changed in this PR
Adds bandwidth rollback when multi-link stream preparation fails.
Changes:
- Introduces master bandwidth rollback logic.
- Invokes rollback from the parameter restoration path.
| File | Description |
|---|---|
drivers/soundwire/stream.c |
Adds failed-preparation bandwidth cleanup. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1497
to
+1500
| list_for_each_entry(rollback_m_rt, &stream->master_list, stream_node) { | ||
| /* Only process masters that were successfully configured before the failure */ | ||
| if (rollback_m_rt == fail_m_rt) | ||
| break; |
davidlin923
force-pushed
the
sdw_bandwidth_leak
branch
from
October 2, 2026 08:15
3a4a673 to
d383038
Compare
bardliao
reviewed
Oct 2, 2026
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>
davidlin923
force-pushed
the
sdw_bandwidth_leak
branch
from
October 2, 2026 14:45
d383038 to
42cf763
Compare
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 introducing sdw_rollback_master_bandwidth() to iterate through all successfully processed masters prior to the failed one, and accurately deduct their allocated port bandwidth from the bus parameters.