[PATCH 2/4] ASoC: meson: aiu: Validate written enum values

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Jun 9 05:57:35 PDT 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing bounds check on user-supplied `item[0]` index leads to an out-of-bounds heap read when evaluating `snd_soc_enum_item_to_val`.
--

commit 9a6f223d3a43c4d946f46b956e844cde37d09bef
Author: HyeongJun An <sammiee5311 at gmail.com>

ASoC: meson: aiu: Validate written enum values

This commit fixes missing bounds checking on user-supplied enumeration
values in the AIU HDMI and internal codec mux put callbacks before they
are passed to snd_soc_enum_item_to_val().

> diff --git a/sound/soc/meson/aiu-acodec-ctrl.c b/sound/soc/meson/aiu-acodec-ctrl.c
> index 483772ba69cd7..94c5d65335233 100644
> --- a/sound/soc/meson/aiu-acodec-ctrl.c
> +++ b/sound/soc/meson/aiu-acodec-ctrl.c
> @@ -36,6 +36,9 @@ static int aiu_acodec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol,
>  	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
>  	unsigned int mux, changed;
>  
> +	if (ucontrol->value.enumerated.item[0] >= e->items)
> +		return -EINVAL;
> +

[Severity: High]
This is a pre-existing issue, but while you are fixing missing enum
validations here, does sound/soc/sdca/sdca_asoc.c:ge_put_enum_double()
suffer from the exact same out-of-bounds read?

In ge_put_enum_double(), the user-supplied index item[0] is passed to
snd_soc_enum_item_to_val() without verifying if it is less than e->items:

ret = snd_soc_enum_item_to_val(e, item[0]);

Because e->values is dynamically allocated on the heap, an unchecked
large item[0] can read memory past the end of the values buffer. If this
out-of-bounds read hits an unmapped page, could it trigger a page fault
via the ALSA control interface?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260609124317.38046-1-sammiee5311@gmail.com?part=2



More information about the linux-amlogic mailing list