Skip to content

audio: mixin_mixout: check sink_get_buffer() return value#10857

Open
abonislawski wants to merge 1 commit into
thesofproject:mainfrom
abonislawski:fix/mixinout_get_sink_buf
Open

audio: mixin_mixout: check sink_get_buffer() return value#10857
abonislawski wants to merge 1 commit into
thesofproject:mainfrom
abonislawski:fix/mixinout_get_sink_buf

Conversation

@abonislawski

Copy link
Copy Markdown
Member

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.

Copilot AI review requested due to automatic review settings June 9, 2026 07:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() in mixin_process() and bail out on error, releasing already-acquired source data on that error path.
  • Add return-value checking for sink_get_buffer() in mixout_process() and bail out on error.

Comment thread src/audio/mixin_mixout/mixin_mixout.c Outdated
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>
@abonislawski abonislawski force-pushed the fix/mixinout_get_sink_buf branch from 28b97ca to c25232e Compare June 9, 2026 09:45
@abonislawski

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants