Skip to content

idc: clear task pointer after free on prepare error#10935

Open
lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:fix-idc
Open

idc: clear task pointer after free on prepare error#10935
lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:fix-idc

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

On a task init failure in idc_prepare(), the task allocation was freed but
the pointer was left set, so a later comp_free path could free it a second
time. Clear dev->task after freeing it.

On task init failure the task allocation was freed but the pointer left
set, allowing a later free path to free it again. Clear the pointer
after freeing.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Copilot AI review requested due to automatic review settings June 17, 2026 13:30

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes a potential double-free in idc_prepare() when task initialization fails by nulling out dev->task after freeing it.

Changes:

  • Set dev->task = NULL after sof_heap_free() on error in idc_prepare().
  • Add a clarifying comment explaining why the pointer is cleared.

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Comment thread src/idc/idc.c
Comment on lines +202 to +204
/* clear the freed pointer so a later comp_free path does
* not free it a second time
*/

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.

The comment seems unnecessary in this case.

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