Skip to content

ASoC: SOF: ipc3-control: Reject ABI data size larger than the TLV pay… - #5871

Open
ujfalusi wants to merge 1 commit into
thesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/ipc3-control-ext-put-data
Open

ASoC: SOF: ipc3-control: Reject ABI data size larger than the TLV pay…#5871
ujfalusi wants to merge 1 commit into
thesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/ipc3-control-ext-put-data

Conversation

@ujfalusi

@ujfalusi ujfalusi commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

…load

sof_ipc3_bytes_ext_put() copies header.length bytes from user space into cdata->data, but the amount of payload later sent to the firmware is taken from the ABI header's own size field. Nothing checks that the two agree, so a user claiming a size larger than the data it actually provided makes the driver send the stale tail of the previous control value to the DSP. The same stale tail is returned to user space by a subsequent bytes_ext_get() that does not read back from the DSP.

Reject the payload if the ABI size field exceeds the data available in the TLV block. header.length has already been verified to be at least sizeof(struct sof_abi_hdr), so the subtraction cannot underflow.

Fixes: 67ec2a0 ("ASoC: SOF: Add bytes_ext control IPC ops for IPC3")
Cc: stable@vger.kernel.org

Copilot AI lite review requested due to automatic review settings August 7, 2026 08:04
…load

sof_ipc3_bytes_ext_put() copies header.length bytes from user space into
cdata->data, but the amount of payload later sent to the firmware is taken
from the ABI header's own size field. Nothing checks that the two agree, so
a user claiming a size larger than the data it actually provided makes the
driver send the stale tail of the previous control value to the DSP. The
same stale tail is returned to user space by a subsequent bytes_ext_get()
that does not read back from the DSP.

Reject the payload if the ABI size field exceeds the data available in the
TLV block. header.length has already been verified to be at least
sizeof(struct sof_abi_hdr), so the subtraction cannot underflow.

Fixes: 67ec2a0 ("ASoC: SOF: Add bytes_ext control IPC ops for IPC3")
Cc: stable@vger.kernel.org
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

Copilot AI left a comment

Copy link
Copy Markdown

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 the SOF IPC3 bytes_ext control write path against mismatched size fields that could cause stale tail bytes from a previous control value to be sent to the DSP (and later echoed back to userspace without a DSP readback).

Changes:

  • Computes the TLV payload size (excluding struct sof_abi_hdr) from header.length.
  • Rejects writes where sof_abi_hdr.size exceeds the bytes actually provided in the TLV block, preventing stale data from being transmitted/returned.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants