Skip to content

ipc3: helper: clear component pipeline pointers before freeing pipeline#10852

Open
tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/fix/ipc3/clear_component_pointers
Open

ipc3: helper: clear component pipeline pointers before freeing pipeline#10852
tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/fix/ipc3/clear_component_pointers

Conversation

@tmleman
Copy link
Copy Markdown
Contributor

@tmleman tmleman commented Jun 8, 2026

When ipc_pipeline_free() frees a pipeline, component devices that were connected to it retain stale cd->pipeline pointers. If an IPC (e.g. stream position request) later dereferences that pointer, it triggers a use-after-free.

Fix this by iterating all components in the IPC comp_list and setting cd->pipeline = NULL for any component whose pipeline matches the one being freed. This makes the existing NULL checks in handler.c effective and prevents the dangling pointer dereference.

Found by fuzzing with AddressSanitizer enabled.

Copilot AI review requested due to automatic review settings June 8, 2026 13: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

Fixes a potential use-after-free in IPC3 pipeline teardown by ensuring components no longer hold dangling cd->pipeline pointers after ipc_pipeline_free() frees the pipeline object.

Changes:

  • Iterate ipc->comp_list during ipc_pipeline_free() and clear cd->pipeline for components still referencing the pipeline being freed.

Comment thread src/ipc/ipc3/helper.c
@tmleman tmleman force-pushed the topic/upstream/pr/fix/ipc3/clear_component_pointers branch from e14ed5b to 9e1dd00 Compare June 8, 2026 14:14
When ipc_pipeline_free() frees a pipeline, component devices that
were connected to it retain stale cd->pipeline pointers. If an IPC
(e.g. stream position request) later dereferences that pointer, it
triggers a use-after-free.

Fix this by iterating all components in the IPC comp_list and setting
cd->pipeline = NULL for any component whose pipeline matches the one
being freed. This makes the existing NULL checks in handler.c
effective and prevents the dangling pointer dereference.

Found by fuzzing with AddressSanitizer enabled.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
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