* [PATCH 2/4] ASoC: meson: aiu: Validate written enum values [not found] <20260609124317.38046-1-sammiee5311@gmail.com> @ 2026-06-09 12:43 ` HyeongJun An 2026-06-09 12:57 ` sashiko-bot 0 siblings, 1 reply; 2+ messages in thread From: HyeongJun An @ 2026-06-09 12:43 UTC (permalink / raw) To: Mark Brown, Liam Girdwood Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel, HyeongJun An, Jerome Brunet, Neil Armstrong, Kevin Hilman, Martin Blumenstingl, linux-arm-kernel, linux-amlogic The AIU HDMI and internal codec mux put callbacks use the written enum value with snd_soc_enum_item_to_val() before checking whether the value is valid for the enumeration. Reject out-of-range values before converting the enum item, matching the validation already done by the G12A HDMI and internal codec mux controls. Fixes: b82b734c0e9a ("ASoC: meson: aiu: add hdmi codec control support") Fixes: 65816025d461 ("ASoC: meson: aiu: add internal dac codec control support") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: HyeongJun An <sammiee5311@gmail.com> --- sound/soc/meson/aiu-acodec-ctrl.c | 3 +++ sound/soc/meson/aiu-codec-ctrl.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/sound/soc/meson/aiu-acodec-ctrl.c b/sound/soc/meson/aiu-acodec-ctrl.c index 483772ba69cd..94c5d6533523 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; + mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]); changed = snd_soc_component_test_bits(component, e->reg, CTRL_DIN_LRCLK_SRC, diff --git a/sound/soc/meson/aiu-codec-ctrl.c b/sound/soc/meson/aiu-codec-ctrl.c index 396f815077e2..60bb4cdfee52 100644 --- a/sound/soc/meson/aiu-codec-ctrl.c +++ b/sound/soc/meson/aiu-codec-ctrl.c @@ -28,6 +28,9 @@ static int aiu_codec_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; + mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]); changed = snd_soc_component_test_bits(component, e->reg, CTRL_DATA_SEL, -- 2.43.0 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/4] ASoC: meson: aiu: Validate written enum values 2026-06-09 12:43 ` [PATCH 2/4] ASoC: meson: aiu: Validate written enum values HyeongJun An @ 2026-06-09 12:57 ` sashiko-bot 0 siblings, 0 replies; 2+ messages in thread From: sashiko-bot @ 2026-06-09 12:57 UTC (permalink / raw) To: HyeongJun An; +Cc: neil.armstrong, linux-amlogic 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@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 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-09 12:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260609124317.38046-1-sammiee5311@gmail.com>
2026-06-09 12:43 ` [PATCH 2/4] ASoC: meson: aiu: Validate written enum values HyeongJun An
2026-06-09 12:57 ` sashiko-bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox