Skip to content

Commit f367528

Browse files
committed
audio: mux: Fix incorrect iterator in demux_trigger
demux_trigger() checks for cross-pipeline sinks to set the overrun_permitted flag. Commit 96b4fdb ("buf: use API for iteration bsource_list in components") incorrectly converted the bsink_list iteration to comp_dev_for_each_producer instead of comp_dev_for_each_consumer. Since demux has 1 input and multiple outputs, the loop must iterate over consumers (sinks), not producers (sources). The incorrect iterator caused the pipeline comparison to never match, making audio_stream_set_overrun() unreachable. Fix by using comp_dev_for_each_consumer with comp_buffer_get_sink_component and add a defensive NULL check on the returned component pointer. Issue found using semgrep with custom rules. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
1 parent accf902 commit f367528

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/audio/mux/mux.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,11 @@ static int demux_trigger(struct processing_module *mod, int cmd)
290290
*/
291291
if (cmd == COMP_TRIGGER_PRE_START) {
292292
struct comp_buffer *b;
293+
struct comp_dev *sink_comp;
293294

294-
comp_dev_for_each_producer(mod->dev, b) {
295-
if (comp_buffer_get_sink_component(b)->pipeline != mod->dev->pipeline)
295+
comp_dev_for_each_consumer(mod->dev, b) {
296+
sink_comp = comp_buffer_get_sink_component(b);
297+
if (sink_comp && sink_comp->pipeline != mod->dev->pipeline)
296298
audio_stream_set_overrun(&b->stream, true);
297299
}
298300
}

0 commit comments

Comments
 (0)