Skip to content

Commit

Permalink
fix: comp_dev: initialize buffer lists to prevent NULL dereference
Browse files Browse the repository at this point in the history
This patch addresses a NULL dereference issue in the SOF firmware that
was exposed by a recent change in Zephyr's MMU mapping for Intel ADSP
ACE30. The change prevents mapping of the 0x0 address, which helps catch
NULL pointer accesses.

The issue was identified during testing, where an exception occurred due
to uninitialized buffer lists in the `comp_dev` structure. To fix this,
the `bsink_list` and `bsource_list` are now initialized in the
`comp_alloc` function.

This ensures that the lists point to themselves before any use,
preventing NULL dereference and subsequent exceptions.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
  • Loading branch information
tmleman committed Nov 28, 2024
1 parent 40ed1e2 commit 955d7ee
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/include/sof/audio/component.h
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,8 @@ static inline struct comp_dev *comp_alloc(const struct comp_driver *drv,
dev->size = bytes;
dev->drv = drv;
dev->state = COMP_STATE_INIT;
list_init(&dev->bsink_list);
list_init(&dev->bsource_list);
memcpy_s(&dev->tctx, sizeof(struct tr_ctx),
trace_comp_drv_get_tr_ctx(dev->drv), sizeof(struct tr_ctx));

Expand Down

0 comments on commit 955d7ee

Please sign in to comment.