Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,21 @@ struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv,
if (dev->task)
schedule_task_free(dev->task);
#endif
/* When module_init is called in this function, it can store this dev in its pipeline.
* This happens in the case of the copier (copier_dai_init and copier_host_create).
* The pointers remain set even after a failure. The dev is freed below on this
* creation-failure path before it was added to the IPC component list, so ipc_comp_free()'s
* back-pointer cleanup will never run for it. Clear the stale references now to prevent
* a later use-after-free when the pipeline is prepared or triggered.
*/
if (dev->pipeline) {
if (dev->pipeline->source_comp == dev)
dev->pipeline->source_comp = NULL;
if (dev->pipeline->sink_comp == dev)
dev->pipeline->sink_comp = NULL;
if (dev->pipeline->sched_comp == dev)
dev->pipeline->sched_comp = NULL;
}
module_adapter_mem_free(mod);
return NULL;
}
Expand Down
Loading