]> git.ipfire.org Git - thirdparty/linux.git/commit
ASoC: codecs: simple-mux: Fix enum control bounds check
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Wed, 27 May 2026 12:24:00 +0000 (09:24 -0300)
committerMark Brown <broonie@kernel.org>
Wed, 27 May 2026 12:43:20 +0000 (13:43 +0100)
commitf63ad68e18d774a5d15cd7e405ead63f6b322679
tree06453ee81c16ad3ed8b28b2aca4cb71b24854b1f
parent500eb0203cd1a7b8feea0443f5add9a47444a7b2
ASoC: codecs: simple-mux: Fix enum control bounds check

simple_mux_control_put() rejects values greater than e->items, but
enum control values are zero based. For the two-entry mux used by this
driver, valid values are 0 and 1, so value 2 must be rejected as well.

Accepting e->items can store an invalid mux state, pass it to the GPIO
setter, and pass it on to the DAPM mux update path where it is used as
an index into the enum text array.

Use the same >= e->items check used by the ASoC enum helpers.

Fixes: 342fbb7578d1 ("ASoC: add simple-mux")
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Link: https://patch.msgid.link/20260527-asoc-simple-mux-enum-bounds-v1-1-3f805b9fc671@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/simple-mux.c