From d4e2b2bab6c6fd5e8f2d6cd4720f49aefcd60fdd Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Wed, 9 Sep 2026 14:16:50 +0300 Subject: [PATCH] audio: pipeline: guard against NULL source or sink in pipeline_copy() When a pipeline is being stopped or unbound, the component unbind handler may clear pipeline->source_comp before the low-latency copy task finishes its final execution tick. Attempting to access p->source_comp->direction without checking for NULL triggers a synchronous PIF exception (DSP panic). Add NULL checks for p->source_comp and start before proceeding with the pipeline graph copy walk, returning 0 cleanly if the pipeline endpoints are no longer valid. Signed-off-by: Seppo Ingalsuo --- src/audio/pipeline/pipeline-stream.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/audio/pipeline/pipeline-stream.c b/src/audio/pipeline/pipeline-stream.c index 5fd795e818db..d3cb59026c3f 100644 --- a/src/audio/pipeline/pipeline-stream.c +++ b/src/audio/pipeline/pipeline-stream.c @@ -179,6 +179,11 @@ int pipeline_copy(struct pipeline *p) PPL_LOCK(p->core); + if (!p->source_comp) { + PPL_UNLOCK(); + return 0; + } + if (p->source_comp->direction == SOF_IPC_STREAM_PLAYBACK) { dir = PPL_DIR_UPSTREAM; start = p->sink_comp; @@ -187,6 +192,11 @@ int pipeline_copy(struct pipeline *p) start = p->source_comp; } + if (!start) { + PPL_UNLOCK(); + return 0; + } + data.start = start; data.p = p;