audio: mixin_mixout: reject prepare of an unconnected instance - #11180
Open
tmleman wants to merge 1 commit into
Open
Conversation
tmleman
requested review from
dbaluta,
kv2019i,
lbetlej,
lgirdwood,
mmaka1 and
plbossart
as code owners
September 9, 2026 06:41
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The added guards correctly prevent confirmed NULL-dereference paths for unbound instances and follow established module behavior by returning -ENOTCONN.
Pull request overview
This pull request prevents NULL dereferences in the mixin/mixout modules when a host prepares an instance that was created but never bound (no sink connections), by rejecting .prepare() early with -ENOTCONN. This aligns mixin_prepare()/mixout_prepare() behavior with existing “unconnected instance” guards used by other SOF modules.
Changes:
- Add an early
num_of_sinks == 0guard inmixin_prepare()before dereferencingsinks[0]. - Add an early
num_of_sinks == 0guard inmixout_prepare()before callingmixout_params()(which dereferencesmod->sinks[0]). - Move
mixout_prepare()entry trace before the new guard so the rejected case is still logged.
File summaries
| File | Description |
|---|---|
| src/audio/mixin_mixout/mixin_mixout.c | Adds -ENOTCONN prepare-time rejection for unconnected mixin/mixout instances to avoid sink dereferences when num_of_sinks == 0. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
PR 11180: test resultsRun date: 2026-09-09 07:01 UTC Tested commit: fc0d6b61757bdfaf9c99fdd609a2fcd72cbf28de |
mixin_prepare() and mixout_prepare() dereferenced sinks[0] without checking num_of_sinks. The connection arrays in struct processing_module are only populated by module_adapter_bind(), and module_adapter_sink_src_prepare() forwards them verbatim, so a module instance that the host created but never bound is still prepared with num_of_sinks == 0 and sinks[0] == NULL. A host that issues CREATE_PIPELINE, INIT_MODULE_INSTANCE (mixin/mixout) and then SET_PIPELINE_STATE without any BIND therefore made pipeline_prepare() walk into mixout_params(), where sink_set_valid_fmt(mod->sinks[0], ...) faulted while writing sink->audio_stream_params (SEGV on NULL + 0x14). mixin_prepare() has the same unguarded sink_get_valid_fmt(sinks[0]) one function later; both are fixed here. Reject an instance with no sink in .prepare() with -ENOTCONN before the dereference, matching the existing guards in rtnr_prepare() and mux_process(). This cannot reject a valid configuration: a functional mixin/mixout must have at least one bound sink. The mixout_prepare() entry trace is moved above the check so the rejected case is traced too. Found by the IPC4 libFuzzer harness on native_sim under ASan. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
tmleman
requested review from
abonislawski,
serhiy-katsyuba-intel,
softwarecki and
wjablon1
September 9, 2026 09:17
serhiy-katsyuba-intel
approved these changes
Sep 9, 2026
lgirdwood
approved these changes
Sep 9, 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.
mixin_prepare() and mixout_prepare() dereferenced sinks[0] without checking num_of_sinks. The connection arrays in struct processing_module are only populated by module_adapter_bind(), and
module_adapter_sink_src_prepare() forwards them verbatim, so a module instance that the host created but never bound is still prepared with num_of_sinks == 0 and sinks[0] == NULL.
A host that issues CREATE_PIPELINE, INIT_MODULE_INSTANCE (mixin/mixout) and then SET_PIPELINE_STATE without any BIND therefore made pipeline_prepare() walk into mixout_params(), where sink_set_valid_fmt(mod->sinks[0], ...) faulted while writing sink->audio_stream_params (SEGV on NULL + 0x14). mixin_prepare() has the same unguarded sink_get_valid_fmt(sinks[0]) one function later; both are fixed here.
Reject an instance with no sink in .prepare() with -ENOTCONN before the dereference, matching the existing guards in rtnr_prepare() and mux_process(). This cannot reject a valid configuration: a functional mixin/mixout must have at least one bound sink. The mixout_prepare() entry trace is moved above the check so the rejected case is traced too.
Found by the IPC4 libFuzzer harness on native_sim under ASan.