Skip to content

Commit 48b7687

Browse files
wrobeldagregkh
authored andcommitted
ASoC: codecs: lpass-tx-macro: Fix enum kcontrol accesses
[ Upstream commit 1ba3817 ] The "DEC0 MODE" to "DEC7 MODE" controls are enumerated, but tx_macro_dec_mode_get() and tx_macro_dec_mode_put() access their value through ucontrol->value.integer.value[0] (a long) instead of ucontrol->value.enumerated.item[0] (an unsigned int). This same pattern was fixed in the sibling drivers by commit bcfe5f7 ("ASoC: codecs: rx-macro: fix accessing array out of bounds for enum type") and commit 0ea5eff ("ASoC: codecs: va-macro: fix accessing array out of bounds for enum type"), but tx-macro was missed. On 64-bit kernels built with CONFIG_SND_CTL_DEBUG, the elem value sanity check catches the 4 bytes written past the enumerated item and every read of these controls fails with -EINVAL: snd-sm8250 sound: control 2:0:0:DEC0 MODE:0: access overflow Fixes: c39667d ("ASoC: codecs: lpass-tx-macro: add support for lpass tx macro") Assisted-by: Claude:claude-fable-5 Cc: stable@vger.kernel.org Signed-off-by: Dawid Wróbel <me@dawidwrobel.com> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Link: https://patch.msgid.link/20260730-worktree-lpass-tx-macro-enum-fix-v2-1-6d091c736116@dawidwrobel.com Signed-off-by: Mark Brown <broonie@kernel.org> [ kept `snd_soc_kcontrol_component()` context line instead of upstream's renamed `snd_kcontrol_chip()` ] Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4931c09 commit 48b7687

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

sound/soc/codecs/lpass-tx-macro.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ static int tx_macro_dec_mode_get(struct snd_kcontrol *kcontrol,
10191019
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
10201020
int path = e->shift_l;
10211021

1022-
ucontrol->value.integer.value[0] = tx->dec_mode[path];
1022+
ucontrol->value.enumerated.item[0] = tx->dec_mode[path];
10231023

10241024
return 0;
10251025
}
@@ -1028,7 +1028,7 @@ static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol,
10281028
struct snd_ctl_elem_value *ucontrol)
10291029
{
10301030
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
1031-
int value = ucontrol->value.integer.value[0];
1031+
int value = ucontrol->value.enumerated.item[0];
10321032
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
10331033
int path = e->shift_l;
10341034
struct tx_macro *tx = snd_soc_component_get_drvdata(component);

0 commit comments

Comments
 (0)