audio: mixin_mixout: check sink_get_buffer() return value#10857
Open
abonislawski wants to merge 1 commit into
Open
audio: mixin_mixout: check sink_get_buffer() return value#10857abonislawski wants to merge 1 commit into
abonislawski wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the mixin/mixout buffer acquisition paths by checking sink_get_buffer() return values before using its out-parameters, preventing use of uninitialized buf_size and invalid end-pointer calculations when sink_get_buffer() fails.
Changes:
- Add return-value checking for
sink_get_buffer()inmixin_process()and bail out on error, releasing already-acquired source data on that error path. - Add return-value checking for
sink_get_buffer()inmixout_process()and bail out on error.
sink_get_buffer() can return -EBUSY or -ENODATA without writing its output parameters, so using buf_size right after the call read an uninitialized value and built an invalid buffer end pointer. Check the return value in both acquire sites. In mixout_process() bail out on error. In mixin_process() skip only the failed mixout and keep mixing the rest; the source is consumed once after the loop so it is never reprocessed. Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
28b97ca to
c25232e
Compare
Member
Author
|
Good comment from Copilot, fixed. Updated version: for mixin, in case of failure we skip, and for mixout we fail, exactly like the reference firmware does. |
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.
sink_get_buffer() can return -EBUSY or -ENODATA without writing its output parameters, so using buf_size right after the call read an uninitialized value and built an invalid buffer end pointer. Check the return value and bail out on error in both mixout_process() and the sibling mixin_process() acquire path, releasing already-acquired source data on the mixin path.