audio: aria: reject zero sample group size in init#10891
Open
tmleman wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens aria_init() against host-provided IPC4 base configs that can cause a divide-by-zero when computing the sample group count.
Changes:
- Add validation for
channels_count == 0anddepth < 8before computingsgsand dividingibs / sgs.
Comment on lines
+126
to
+132
| /* sample group size is used as a divisor below, reject configs that make it zero */ | ||
| if (!base_cfg->audio_fmt.channels_count || base_cfg->audio_fmt.depth < 8) { | ||
| comp_err(dev, "invalid channels:%u depth:%u", | ||
| base_cfg->audio_fmt.channels_count, base_cfg->audio_fmt.depth); | ||
| return -EINVAL; | ||
| } | ||
|
|
aria_init() computes sgs = (depth >> 3) * channels_count and then divides ibs by sgs. A host-supplied base config with channels_count of 0 or depth below 8 makes sgs zero, causing a divide-by-zero. Validate channels_count and depth before the division. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
lyakh
approved these changes
Jun 12, 2026
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.
aria_init() computes sgs = (depth >> 3) * channels_count and then divides ibs by sgs. A host-supplied base config with channels_count of 0 or depth below 8 makes sgs zero, causing a divide-by-zero.
Validate channels_count and depth before the division.