From 651273efe8ca58d51c2fe74db9558dad7de67445 Mon Sep 17 00:00:00 2001 From: Tomasz Leman Date: Thu, 11 Jun 2026 17:55:15 +0200 Subject: [PATCH] audio: aria: reject zero sample group size in init 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 --- src/audio/aria/aria.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/audio/aria/aria.c b/src/audio/aria/aria.c index dc265cfac240..ef7285d2f564 100644 --- a/src/audio/aria/aria.c +++ b/src/audio/aria/aria.c @@ -123,6 +123,13 @@ static int aria_init(struct processing_module *mod) list_init(&dev->bsource_list); list_init(&dev->bsink_list); + /* 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:%d", + base_cfg->audio_fmt.channels_count, base_cfg->audio_fmt.depth); + return -EINVAL; + } + cd = mod_zalloc(mod, sizeof(*cd)); if (!cd) { return -ENOMEM;