Skip to content

Commit f16f5c3

Browse files
committed
audio: chain_dma: prevent NULL pointer dereference in chain_task_run
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>
1 parent fdc1c48 commit f16f5c3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/audio/chain_dma.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ static enum task_state chain_task_run(void *data)
168168
uint32_t link_type;
169169
int ret;
170170

171+
if (!cd || !cd->dma_buffer || !cd->chan_link || !cd->chan_host)
172+
return SOF_TASK_STATE_COMPLETED;
173+
171174
/* Link DMA can return -EPIPE and current status if xrun occurs, then it is not critical
172175
* and flow shall continue. Other error values will be treated as critical.
173176
*/

0 commit comments

Comments
 (0)