Skip to content

audio: data_blob: free a pending blob when no blob is committed - #11579

Open
tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/audio/data_blob/fix/mem_leak
Open

tmleman wants to merge 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/audio/data_blob/fix/mem_leak

Conversation

@tmleman

@tmleman tmleman commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

comp_free_data_blob() returned early when blob_handler->data was NULL, without releasing blob_handler->data_new. data_new holds a blob that is still being received, so a host that sends the FIRST fragment of a multi-fragment LARGE_CONFIG_SET to a module without a configuration and then deletes the module, or re-initializes the blob, leaks the whole data_new allocation (up to the host-chosen data_offset_size).

Free data and data_new independently and reset the remaining transfer state, so the handler is left fully empty.

Found with the IPC4 fuzzer: every testcase doing EQ FIR init followed by a FIRST-only large config set leaked one allocation, and with CONFIG_SYS_HEAP_HARDENING_EXTREME the accumulated chunks made every later alloc/free progressively slower.

comp_free_data_blob() returned early when blob_handler->data was NULL,
without releasing blob_handler->data_new. data_new holds a blob that is
still being received, so a host that sends the FIRST fragment of a
multi-fragment LARGE_CONFIG_SET to a module without a configuration
and then deletes the module, or re-initializes the blob, leaks the
whole data_new allocation (up to the host-chosen data_offset_size).

Free data and data_new independently and reset the remaining transfer
state, so the handler is left fully empty.

Found with the IPC4 fuzzer: every testcase doing EQ FIR init followed
by a FIRST-only large config set leaked one allocation, and with
CONFIG_SYS_HEAP_HARDENING_EXTREME the accumulated chunks made every
later alloc/free progressively slower.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 17:01

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.

🟢 Approval recommended

No active review issues remain for the audio blob cleanup change.

No open issues 🎉

What changed in this PR

Fixes a memory leak in audio blob cleanup when a partially received configuration exists but no blob has been committed, covering module deletion and blob reinitialization.

Changes:

  • Removes the early return so committed and pending blobs are freed independently.
  • Resets the pending blob size, transfer position, and readiness flag during cleanup.
File Description
src/​audio/​data_blob.c Releases pending blobs even without committed data and clears remaining transfer state.

Review effort: Balanced

@intel-sofci

Copy link
Copy Markdown

PR 11579: test results

Run date: 2026-12-01 18:13 UTC

Tested commit: 039d5c54098ecb4b3f0b8e16b6e26d21e3e45d83

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

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.

4 participants