Commit 121da6d
Jyri Sarha
ipc4: chain_dma: fix use-after-free on chain DMA deallocate
ipc4_process_chain_dma() called ipc4_chain_dma_state() and then, on the
deallocate path (allocate == 0 && enable == 0), unconditionally executed
list_item_del(&cdma_comp->list).
However, on that same deallocate path ipc4_chain_dma_state() already
unlinks the matching ipc_comp_dev from ipc->comp_list and frees it with
rfree():
list_item_del(&icd->list);
rfree(icd);
Since icd is the same object as cdma_comp, the subsequent
list_item_del(&cdma_comp->list) in the caller dereferenced and wrote to
already-freed memory (prev->next / next->prev), a use-after-free. With
heap grooming a host sending GLB_CHAIN_DMA with allocate=0/enable=0 on an
existing chain could turn this into controlled heap corruption.
The unlink-before-free is already handled correctly by
ipc4_chain_dma_state(), so the duplicate list_item_del() in the caller is
both redundant and unsafe. Remove it.
Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>1 parent 0666910 commit 121da6d
1 file changed
Lines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | 614 | | |
618 | 615 | | |
619 | 616 | | |
| |||
0 commit comments