Skip to content

plugin: tplg: bound pipeline_list against TPLG_MAX_PCM_PIPELINES#10880

Open
jsarha wants to merge 1 commit into
thesofproject:mainfrom
jsarha:alsa_plugin_security_fix
Open

plugin: tplg: bound pipeline_list against TPLG_MAX_PCM_PIPELINES#10880
jsarha wants to merge 1 commit into
thesofproject:mainfrom
jsarha:alsa_plugin_security_fix

Conversation

@jsarha

@jsarha jsarha commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

plug_prepare_widget() appends each new pipeline referenced by a PCM into the fixed-size pipeline_list->pipelines[] array:

pipeline_list->pipelines[pipeline_list->count] = comp_info->pipe_info;
pipeline_list->count++;

The array has only TPLG_MAX_PCM_PIPELINES entries, but the number of pipelines bound to a PCM is dictated by the topology graph, which comes from the .tplg file loaded by the SOF ALSA plugin. With no upper-bound check, a topology that binds more than TPLG_MAX_PCM_PIPELINES pipelines to a single PCM writes past the end of the array.

Reject the store with -EINVAL once the list is full, before writing past the end of the array.

plug_prepare_widget() appends each new pipeline referenced by a PCM into
the fixed-size pipeline_list->pipelines[] array:

	pipeline_list->pipelines[pipeline_list->count] = comp_info->pipe_info;
	pipeline_list->count++;

The array has only TPLG_MAX_PCM_PIPELINES entries, but the number of
pipelines bound to a PCM is dictated by the topology graph, which
comes from the .tplg file loaded by the SOF ALSA plugin. With no
upper-bound check, a topology that binds more than
TPLG_MAX_PCM_PIPELINES pipelines to a single PCM writes past the end
of the array.

Reject the store with -EINVAL once the list is full, before writing
past the end of the array.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Copilot AI review requested due to automatic review settings June 11, 2026 14:26

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 SOF ALSA plugin topology handling by preventing an out-of-bounds write when accumulating pipelines bound to a single PCM, where the pipeline count is dictated by the externally-provided .tplg graph.

Changes:

  • Add an upper-bound check against TPLG_MAX_PCM_PIPELINES before appending to pipeline_list->pipelines[].
  • Emit a clear error and reject the topology processing path with -EINVAL when the per-PCM pipeline list is full.

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.

6 participants