Skip to content

audio: copier: avoid serializing uninitialized stream position to host#10859

Open
abonislawski wants to merge 1 commit into
thesofproject:mainfrom
abonislawski:fix/comp_posn
Open

audio: copier: avoid serializing uninitialized stream position to host#10859
abonislawski wants to merge 1 commit into
thesofproject:mainfrom
abonislawski:fix/comp_posn

Conversation

@abonislawski

Copy link
Copy Markdown
Member

copier_get_configuration() returns LLP/position data to the host over IPC4 for IPC4_COPIER_MODULE_CFG_PARAM_LLP_READING and _EXTENDED. It declared the source 'posn' on the stack without initialization and called comp_position() ignoring its return value. On Zephyr-native DAI builds dai_common_position() writes posn.comp_posn only after a successful dma_get_status(); on a DMA-status error it returns early, leaving comp_posn uninitialized. The unchecked return then let convert_u64_to_u32s() serialize uninitialized stack bytes into the host reply and report a fabricated stream position.

copier_get_configuration() returns LLP/position data to the host over
IPC4 for IPC4_COPIER_MODULE_CFG_PARAM_LLP_READING and _EXTENDED. It
declared the source 'posn' on the stack without initialization and called
comp_position() ignoring its return value. On Zephyr-native DAI builds
dai_common_position() writes posn.comp_posn only after a successful
dma_get_status(); on a DMA-status error it returns early, leaving
comp_posn uninitialized. The unchecked return then let convert_u64_to_u32s()
serialize uninitialized stack bytes into the host reply (information
disclosure) and report a fabricated stream position.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Copilot AI review requested due to automatic review settings June 9, 2026 08:47
@abonislawski abonislawski requested a review from pblaszko as a code owner June 9, 2026 08:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes IPC4 copier LLP/position reporting to avoid returning fabricated stream position data to the host when the DAI position query fails.

Changes:

  • Zero-initializes the sof_ipc_stream_posn stack struct before use.
  • Checks and propagates comp_position() errors instead of ignoring the return value for LLP reading (standard and extended) replies.

Comment thread src/audio/copier/copier.c
Comment thread src/audio/copier/copier.c
@abonislawski

Copy link
Copy Markdown
Member Author

Copilot's comments are wrong and don't follow the SOF error convention for get_large_config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants