volume: validate host-supplied config and fix init error path#10919
Open
lgirdwood wants to merge 3 commits into
Open
volume: validate host-supplied config and fix init error path#10919lgirdwood wants to merge 3 commits into
lgirdwood wants to merge 3 commits into
Conversation
On an invalid ramp type the init error path freed the component data then read a field from it. Free the dependent allocation before the component data and stop dereferencing it afterwards. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Init read a per-channel config array sized by the channel count from the init payload without checking the payload was large enough, reading past the mailbox. Require the payload to cover the base config and all per-channel entries. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The attenuation setter only rejected oversized payloads, then dereferenced the data as a 32-bit value; a shorter payload read past the mailbox. Require exactly a 32-bit payload. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Hardens the volume component against malformed host-supplied IPC payloads and fixes a use-after-free in an IPC3 init error path.
Changes:
- Add IPC4 init payload size validation before iterating per-channel config.
- Tighten attenuation control payload validation to require exactly 32 bits.
- Fix IPC3 init error cleanup order to avoid dereferencing freed memory.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/audio/volume/volume_ipc4.c | Adds IPC4 init/config size validation and tightens attenuation payload size checks. |
| src/audio/volume/volume_ipc3.c | Adjusts error-path frees to avoid a use-after-free during init failure. |
Comment on lines
+133
to
+137
| if (cfg->size < sizeof(*vol) + channels_count * sizeof(vol->config[0])) { | ||
| comp_err(dev, "Invalid init payload size %zu for %u channels", | ||
| cfg->size, channels_count); | ||
| return -EINVAL; | ||
| } |
Comment on lines
+283
to
286
| if (data_size < (int)sizeof(uint32_t) || data_size > sizeof(uint32_t)) { | ||
| comp_err(dev, "attenuation data size %d is incorrect", data_size); | ||
| return -EINVAL; | ||
| } |
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.
Hardening of host-supplied data in the volume component, plus an error-path
fix:
freed and then dereferenced)
config array before iterating it
No functional change for valid configurations.