Patch "ASoC: meson: g12a-toacodec: Validate written enum values" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: meson: g12a-toacodec: Validate written enum values

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-meson-g12a-toacodec-validate-written-enum-value.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 69dc7179c8414af40c52fc10df2814e6916b95a8
Author: Mark Brown <broonie@xxxxxxxxxx>
Date:   Wed Jan 3 18:34:01 2024 +0000

    ASoC: meson: g12a-toacodec: Validate written enum values
    
    [ Upstream commit 3150b70e944ead909260285dfb5707d0bedcf87b ]
    
    When writing to an enum we need to verify that the value written is valid
    for the enumeration, the helper function snd_soc_item_enum_to_val() doesn't
    do it since it needs to return an unsigned (and in any case we'd need to
    check the return value).
    
    Fixes: af2618a2eee8 ("ASoC: meson: g12a: add internal DAC glue driver")
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240103-meson-enum-val-v1-1-424af7a8fb91@xxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/meson/g12a-toacodec.c b/sound/soc/meson/g12a-toacodec.c
index ddc667956cf5e..3b1ce9143c653 100644
--- a/sound/soc/meson/g12a-toacodec.c
+++ b/sound/soc/meson/g12a-toacodec.c
@@ -71,6 +71,9 @@ static int g12a_toacodec_mux_put_enum(struct snd_kcontrol *kcontrol,
 	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
 	unsigned int mux, reg;
 
+	if (ucontrol->value.enumerated.item[0] >= e->items)
+		return -EINVAL;
+
 	mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]);
 	regmap_field_read(priv->field_dat_sel, &reg);
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux