ASoC: SOF: ipc4-topology: Allow bytes controls without initial payload#5708
Open
ujfalusi wants to merge 1 commit intothesofproject:topic/sof-devfrom
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts the IPC4 SOF topology bytes-control loader to accept bytes controls that have no initial private payload, matching the stated topology constraints and the driver’s intended handling of “no initial data” cases.
Changes:
- Relax the minimum-size validation so
priv_size == 0is permitted for bytes controls (previously rejected as “insufficient”).
Comments suppressed due to low confidence (1)
sound/soc/sof/ipc4-topology.c:2978
- Allowing priv_size == 0 here means we can allocate a bytes control with an all-zero sof_abi_hdr in control_data->data (kzalloc). Later code uses data->type to build msg->extension (e.g., control_load_bytes() itself sets msg->extension from control_data->data->type, and bytes_ext_volatile_get() / refresh paths call sof_ipc4_set_get_bytes_data() / sof_ipc4_refresh_bytes_control() which also rely on data->type). With type left at 0, GET operations can send an invalid param_id (0) and user-visible reads may return an uninitialized ABI header (magic/type/abi all zero). Consider initializing the ABI header fields when priv_size==0 (at least magic and a valid type/param_id if it can be derived), and/or gating GET/refresh paths to avoid issuing IPC until a valid type is known.
if (scontrol->priv_size && scontrol->priv_size < sizeof(struct sof_abi_hdr)) {
dev_err(sdev->dev,
"bytes control %s initial data size %zu is insufficient.\n",
scontrol->name, scontrol->priv_size);
return -EINVAL;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kv2019i
reviewed
Mar 23, 2026
Collaborator
kv2019i
left a comment
There was a problem hiding this comment.
Typo in commit message (s/fro/for), otherwise looks good.
It is unexpected, but allowed to have no initial payload for a bytes control and the code is prepared to handle this case, but the size check missed this corner case. Update the check for minimal size to allow the initial size to be 0. Cc: stable@vger.kernel.org Fixes: a653820 ("ASoC: SOF: ipc4-topology: Correct the allocation size for bytes controls") Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
16e6b29 to
290e3e3
Compare
bardliao
approved these changes
Mar 23, 2026
lgirdwood
approved these changes
Mar 23, 2026
singalsu
approved these changes
Mar 23, 2026
Collaborator
singalsu
left a comment
There was a problem hiding this comment.
I tried removed bytes control initialization, got a topology parse fail, while with this patch it didn't happen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is unexpected, but allowed to have no initial payload for a bytes control and the code is prepared to handle this case, but the size check missed this corner case.
Update the check fro minimal size to allow the initial size to be 0.
Cc: stable@vger.kernel.org
Fixes: a653820 ("ASoC: SOF: ipc4-topology: Correct the allocation size for bytes controls")