Skip to content

module_adapter: validate connection count against module capacity#10791

Open
abonislawski wants to merge 1 commit into
thesofproject:mainfrom
abonislawski:fix/module-adapter-oob
Open

module_adapter: validate connection count against module capacity#10791
abonislawski wants to merge 1 commit into
thesofproject:mainfrom
abonislawski:fix/module-adapter-oob

Conversation

@abonislawski
Copy link
Copy Markdown
Member

Add a bounds check in module_adapter_prepare() to reject topologies where the actual number of connected sources or sinks exceeds the module-declared capacity (max_sources / max_sinks).

Without this check, a misconfigured topology binding more sources than a module supports leads to out-of-bounds writes into the input_buffers or output_buffers arrays allocated for max_sources/max_sinks entries.

The audio_stream copy path already validates this (in module_adapter_audio_stream_type_copy), but the raw-data path had no equivalent guard in either prepare or copy.

Add a bounds check in module_adapter_prepare() to reject topologies
where the actual number of connected sources or sinks exceeds the
module-declared capacity (max_sources / max_sinks).

Without this check, a misconfigured topology binding more sources than
a module supports leads to out-of-bounds writes into the input_buffers
or output_buffers arrays allocated for max_sources/max_sinks entries.

The audio_stream copy path already validates this (in
module_adapter_audio_stream_type_copy), but the raw-data path had no
equivalent guard in either prepare or copy.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
@abonislawski abonislawski requested a review from ranj063 as a code owner May 18, 2026 18:22
Copilot AI review requested due to automatic review settings May 18, 2026 18:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a capacity validation in module_adapter_prepare() so raw/audio-stream module adapters reject topologies with more connected sources or sinks than the module declares it can handle.

Changes:

  • Counts connected sources and sinks during prepare.
  • Rejects configurations where those counts exceed max_sources or max_sinks.

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