From 039d5c54098ecb4b3f0b8e16b6e26d21e3e45d83 Mon Sep 17 00:00:00 2001 From: Tomasz Leman Date: Tue, 1 Dec 2026 16:29:45 +0000 Subject: [PATCH] audio: data_blob: free a pending blob when no blob is committed 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 --- src/audio/data_blob.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/audio/data_blob.c b/src/audio/data_blob.c index 530487f2f330..9814dde85290 100644 --- a/src/audio/data_blob.c +++ b/src/audio/data_blob.c @@ -42,14 +42,17 @@ static void comp_free_data_blob(struct comp_data_blob_handler *blob_handler) { assert(blob_handler); - if (!blob_handler->data) - return; - + /* data_new may hold a partially received blob even when no blob has + * been committed to data yet, so the two must be released independently. + */ blob_handler->free(blob_handler, blob_handler->data); blob_handler->free(blob_handler, blob_handler->data_new); blob_handler->data = NULL; blob_handler->data_new = NULL; blob_handler->data_size = 0; + blob_handler->new_data_size = 0; + blob_handler->data_pos = 0; + blob_handler->data_ready = false; } void comp_data_blob_set_validator(struct comp_data_blob_handler *blob_handler,