]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ALSA: control: Apply sanity check of input values for user elements
authorTakashi Iwai <tiwai@suse.de>
Sun, 16 Jun 2024 07:34:44 +0000 (09:34 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 18 Jun 2024 10:00:18 +0000 (12:00 +0200)
commit50ed081284fe2bfd1f25e8b92f4f6a4990e73c0a
tree4dde9b20cb4ef34348014ca84c5b8e8308278e50
parent5bae83007bdd71919a38d5c6db020ef43e2299c6
ALSA: control: Apply sanity check of input values for user elements

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@molgen.mpg.de>
Closes: https://lore.kernel.org/r/1d44be36-9bb9-4d82-8953-5ae2a4f09405@molgen.mpg.de
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/20240616073454.16512-4-tiwai@suse.de
sound/core/control.c