Patch "ALSA: control: Apply sanity check of input values for user elements" 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

    ALSA: control: Apply sanity check of input values for user elements

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:
     alsa-control-apply-sanity-check-of-input-values-for-.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 fa4823ae83dbe1fd42ef16a90397d5dd0e305f76
Author: Takashi Iwai <tiwai@xxxxxxx>
Date:   Sun Jun 16 09:34:44 2024 +0200

    ALSA: control: Apply sanity check of input values for user elements
    
    [ Upstream commit 50ed081284fe2bfd1f25e8b92f4f6a4990e73c0a ]
    
    Although we have already a mechanism for sanity checks of input values
    for control writes, it's not applied unless the kconfig
    CONFIG_SND_CTL_INPUT_VALIDATION is set due to the performance reason.
    Nevertheless, it still makes sense to apply the same check for user
    elements despite of its cost, as that's the only way to filter out the
    invalid values; the user controls are handled solely in ALSA core
    code, and there is no corresponding driver, after all.
    
    This patch adds the same input value validation for user control
    elements at its put callback.  The kselftest will be happier with this
    change, as the incorrect values will be bailed out now with errors.
    
    For other normal controls, the check is applied still only when
    CONFIG_SND_CTL_INPUT_VALIDATION is set.
    
    Reported-by: Paul Menzel <pmenzel@xxxxxxxxxxxxx>
    Closes: https://lore.kernel.org/r/1d44be36-9bb9-4d82-8953-5ae2a4f09405@xxxxxxxxxxxxx
    Reviewed-by: Jaroslav Kysela <perex@xxxxxxxx>
    Reviewed-by: Mark Brown <broonie@xxxxxxxxxx>
    Reviewed-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
    Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
    Link: https://lore.kernel.org/20240616073454.16512-4-tiwai@xxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/core/control.c b/sound/core/control.c
index 82aa1af1d1d8..92266c97238d 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1477,12 +1477,16 @@ static int snd_ctl_elem_user_get(struct snd_kcontrol *kcontrol,
 static int snd_ctl_elem_user_put(struct snd_kcontrol *kcontrol,
 				 struct snd_ctl_elem_value *ucontrol)
 {
-	int change;
+	int err, change;
 	struct user_element *ue = kcontrol->private_data;
 	unsigned int size = ue->elem_data_size;
 	char *dst = ue->elem_data +
 			snd_ctl_get_ioff(kcontrol, &ucontrol->id) * size;
 
+	err = sanity_check_input_values(ue->card, ucontrol, &ue->info, false);
+	if (err < 0)
+		return err;
+
 	change = memcmp(&ucontrol->value, dst, size) != 0;
 	if (change)
 		memcpy(dst, &ucontrol->value, size);




[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