Repository navigation
Conversation
The SRC process and is_ready_to_process functions use sources[0] and sinks[0] without checking the number of sources and sinks. The sink of the SRC can be unbound while the pipeline of the SRC keeps running, e.g. when the SRC output goes to a module in another pipeline that is stopped while another PCM keeps the SRC pipeline running. The module adapter then sets num_of_sinks to zero but keeps the stale pointer in mod->sinks[0], and the SRC writes to the freed buffer. This was seen as a DSP panic (StoreProhibited) in src_polyphase_stage_cir() when the 16 kHz ECNS PCM was stopped while the 48 kHz ECNS PCM was running on a shared echo reference pipeline. Do not use sources[0] or sinks[0] unless there is exactly one source and one sink. With a source but no sink, drop the available input instead, so that a shared upstream module, e.g. a copier with several sinks, is not stalled by the full input buffer of the SRC. src_is_ready_to_process() reports data to drop as ready for the DP case. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the SRC changes intended to prevent stale-buffer access when a source or sink is unbound.
No open issues 🎉
What changed in this PR
This PR protects the sample rate converter (SRC) from accessing stale buffers when a source or sink is unbound while its pipeline remains running.
Changes:
- Guard processing and readiness checks so normal processing requires exactly one source and one sink.
- Drop available input when the sink is absent to avoid blocking shared upstream modules, and report that input as ready for DP processing.
| File | Description |
|---|---|
src/audio/src/src_common.c |
Adds source/sink count guards and a documented helper to discard input when no sink is connected. |
Review effort: Balanced
PR 11547: test resultsRun date: 2026-11-26 18:29 UTC Tested commit: 358b36b7dd4152554fce5b09d0447ad6073c8868 |
| * \brief Drop the input of an SRC that has no sink. | ||
| * | ||
| * The sink of the SRC can be unbound while the pipeline of the SRC keeps | ||
| * running, e.g. when the SRC output goes to another pipeline that is stopped. | ||
| * The input is dropped so that a shared upstream module, e.g. a copier with | ||
| * several sinks, is not stalled by the full input buffer of the SRC. | ||
| * | ||
| * \param[in] source Input of the SRC | ||
| * \return 0 or a negative error code | ||
| */ |
There was a problem hiding this comment.
I think this needs to be fixed at the level up in the pipeline or module layer as teh same situation could happen to any DP module when connected to LL pipelines. Can you ask agent to investigate and plan at the higher level so all DP modules are protected here.
The SRC process and is_ready_to_process functions use sources[0] and sinks[0] without checking the number of sources and sinks. The sink of the SRC can be unbound while the pipeline of the SRC keeps running, e.g. when the SRC output goes to a module in another pipeline that is stopped while another PCM keeps the SRC pipeline running. The module adapter then sets num_of_sinks to zero but keeps the stale pointer in mod->sinks[0], and the SRC writes to the freed buffer. This was seen as a DSP panic (StoreProhibited) in src_polyphase_stage_cir() when the 16 kHz ECNS PCM was stopped while the 48 kHz ECNS PCM was running on a shared echo reference pipeline.
Do not use sources[0] or sinks[0] unless there is exactly one source and one sink. With a source but no sink, drop the available input instead, so that a shared upstream module, e.g. a copier with several sinks, is not stalled by the full input buffer of the SRC. src_is_ready_to_process() reports data to drop as ready for the DP case.