Skip to content

Commit

Permalink
DP: bugix - lists initialization was done too late
Browse files Browse the repository at this point in the history
in case module prepare fails, dp_queue lists were left
uninitialized.
It may lead to crash if module reset was performed later

Signed-off-by: Marcin Szkudlinski <[email protected]>
  • Loading branch information
marcinszkudlinski committed Nov 9, 2023
1 parent c8f675d commit cad46dc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ static int module_adapter_dp_queue_prepare(struct comp_dev *dev)
* first, set all parameters by calling "module prepare" with pointers to
* "main" audio_stream buffers
*/
list_init(&mod->dp_queue_ll_to_dp_list);
list_init(&mod->dp_queue_dp_to_ll_list);

ret = module_adapter_sink_src_prepare(dev);
if (ret)
return ret;
Expand All @@ -177,7 +180,6 @@ static int module_adapter_dp_queue_prepare(struct comp_dev *dev)
* and copy stream parameters to shadow buffers
*/
i = 0;
list_init(&mod->dp_queue_ll_to_dp_list);
list_for_item(blist, &dev->bsource_list) {
struct comp_buffer *source_buffer =
container_of(blist, struct comp_buffer, sink_list);
Expand Down Expand Up @@ -211,7 +213,6 @@ static int module_adapter_dp_queue_prepare(struct comp_dev *dev)
unsigned int period = UINT32_MAX;

i = 0;
list_init(&mod->dp_queue_dp_to_ll_list);
list_for_item(blist, &dev->bsink_list) {
struct comp_buffer *sink_buffer =
container_of(blist, struct comp_buffer, source_list);
Expand Down

0 comments on commit cad46dc

Please sign in to comment.