Repository navigation
Conversation
copier_dai_create() can fail after one or more copier_dai_init() calls succeeded: a later endpoint init can fail, get_converter_func() can find no converter for the host-supplied formats, or the ALH multi-endpoint buffer allocation can fail. These paths returned straight away and copier_init() then only freed the copier private data. Since the copier is never created, copier_free() never runs, so the resources taken by dai_common_new() and dai_config() were leaked: the DAI reference from dai_get(), the DMA reference, the dai_spec_config copy and the DAI group membership. The dai_data itself is reclaimed by the module memory cleanup, which also leaves a dangling entry on the DAI group list. Unwind with copier_dai_free(), which releases exactly the cd->endpoint_num endpoints that were initialized. Found with the IPC4 fuzzer: a DAI copier INIT_INSTANCE with a format combination that has no converter leaked three allocations per testcase. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the DAI copier failure-path cleanup changes.
No open issues 🎉
What changed in this PR
This PR fixes resource leaks during DAI copier creation by releasing initialized endpoints when creation fails, before module memory cleanup runs.
Changes:
- Routes endpoint initialization, converter lookup, and multi-endpoint buffer allocation failures through a shared cleanup path.
- Reuses
copier_dai_free()to release initialized endpoints while preserving the original error code.
| File | Description |
|---|---|
src/audio/copier/copier_dai.c |
Adds endpoint teardown to DAI copier creation failure paths. |
Review effort: Balanced
PR 11580: test resultsRun date: 2026-12-01 18:48 UTC Tested commit: 8f96d4178f4e28f2b4418835879c76aa64cbff37 |
lgirdwood
approved these changes
Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
copier_dai_create() can fail after one or more copier_dai_init() calls succeeded: a later endpoint init can fail, get_converter_func() can find no converter for the host-supplied formats, or the ALH multi-endpoint buffer allocation can fail. These paths returned straight away and copier_init() then only freed the copier private data. Since the copier is never created, copier_free() never runs, so the resources taken by dai_common_new() and dai_config() were leaked: the DAI reference from dai_get(), the DMA reference, the dai_spec_config copy and the DAI group membership. The dai_data itself is reclaimed by the module memory cleanup, which also leaves a dangling entry on the DAI group list.
Unwind with copier_dai_free(), which releases exactly the cd->endpoint_num endpoints that were initialized.
Found with the IPC4 fuzzer: a DAI copier INIT_INSTANCE with a format combination that has no converter leaked three allocations per testcase.