Skip to content

chain dma: fix oops at stream close#11030

Open
lgirdwood wants to merge 3 commits into
thesofproject:mainfrom
lgirdwood:chain-dma-fix
Open

chain dma: fix oops at stream close#11030
lgirdwood wants to merge 3 commits into
thesofproject:mainfrom
lgirdwood:chain-dma-fix

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Some of this duplicates @lyakh PR, but agent provided some additional patches to prevent the NULL deref. Test in CI now and review comments will be folded before merge. Likely drop 1/3 in favour of @lyakh update.

lrgirdwo added 3 commits July 23, 2026 15:45
… during task free

When a task is freed by zephyr_ll_task_free(), zephyr_ll_run() can still hold
a reference to the task's pdata structure across the LL lock boundary.
Re-fetching task->priv_data under zephyr_ll_lock() prevents evaluating
pdata->freeing on a stale/freed pointer. Additionally, add NULL checks for
pdata in zephyr_ll_task_done() and task/pdata in zephyr_ll_task_free().

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
…p_thread_ipc

Move task_dp_pdata assignment after checking pmod and validate pmod->dev,
pmod->dev->task, and pmod->dev->task->priv_data pointers before dereferencing
to prevent NULL pointer crashes.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Validate cd, cd->dma_buffer, cd->chan_link, and cd->chan_host at the start
of chain_task_run() to handle stream teardown cleanly when buffers or channels
are freed before task completion.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Comment thread src/schedule/zephyr_ll.c
task->state = SOF_TASK_STATE_FREE;

if (pdata->freeing)
if (pdata && pdata->freeing)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than checking here, could this be fixed at source to ensure the data is valid through the life cycle of zephyr_ll_task_free() ?

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.

2 participants