Skip to content

ipc4: helper: validate host device_count before indexing channel map#10864

Open
abonislawski wants to merge 1 commit into
thesofproject:mainfrom
abonislawski:fix/channel-map-dev-count
Open

ipc4: helper: validate host device_count before indexing channel map#10864
abonislawski wants to merge 1 commit into
thesofproject:mainfrom
abonislawski:fix/channel-map-dev-count

Conversation

@abonislawski

Copy link
Copy Markdown
Member

dma_cfg->channel_map.device_count comes from a host supplied gateway config blob and was used directly to bound the loop indexing the fixed channel_map.map[GTW_DMA_DEVICE_MAX_COUNT] array, allowing an out-of-bounds read. Reject counts above the ABI maximum with IPC4_INVALID_REQUEST.

dma_cfg->channel_map.device_count comes from a host supplied gateway
config blob and was used directly to bound the loop indexing the fixed
channel_map.map[GTW_DMA_DEVICE_MAX_COUNT] array, allowing an out-of-bounds
read. Reject counts above the ABI maximum with IPC4_INVALID_REQUEST.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Copilot AI review requested due to automatic review settings June 10, 2026 09:27

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 hardens IPC4 gateway DMA configuration parsing by validating dma_cfg->channel_map.device_count (host-supplied) before using it to index the fixed-size channel_map.map[GTW_DMA_DEVICE_MAX_COUNT] array, preventing out-of-bounds reads in ipc4_find_dma_config_multiple().

Changes:

  • Cache device_count locally and reject values above GTW_DMA_DEVICE_MAX_COUNT.
  • Return IPC4_INVALID_REQUEST (and log) when the host provides an invalid device_count.

Comment thread src/ipc/ipc4/helper.c
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