Repository navigation
soundwire: stream: Fix bandwidth leak in multi-link aggregation failure - #5964
davidlin923 wants to merge 1 commit into
Conversation
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.
3a4a673 to
d383038
Compare
d383038 to
42cf763
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Several failure paths still leak or corrupt bandwidth and lane-allocation state.
1 open finding
1 resolved since last review
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
42cf763 to
d360c43
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The rollback dereferences an uninitialized pointer, misses one failure path, and can desynchronize software state from switched hardware.
3 open findings
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
d360c43 to
1be02c8
Compare
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>
1be02c8 to
4715754
Compare


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.