Commit 0cafae90 authored by Takashi Iwai's avatar Takashi Iwai Committed by Greg Kroah-Hartman

ALSA: usb-audio: Don't create a mixer element with bogus volume range

[ Upstream commit e9a0ef0b ]

Some USB-audio descriptors provide a bogus volume range (e.g. volume
min and max are identical), which confuses user-space.
This patch makes the driver skipping such a control element.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206221
Link: https://lore.kernel.org/r/20200214144928.23628-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ac6724d4
...@@ -1699,6 +1699,16 @@ static void __build_feature_ctl(struct usb_mixer_interface *mixer, ...@@ -1699,6 +1699,16 @@ static void __build_feature_ctl(struct usb_mixer_interface *mixer,
/* get min/max values */ /* get min/max values */
get_min_max_with_quirks(cval, 0, kctl); get_min_max_with_quirks(cval, 0, kctl);
/* skip a bogus volume range */
if (cval->max <= cval->min) {
usb_audio_dbg(mixer->chip,
"[%d] FU [%s] skipped due to invalid volume\n",
cval->head.id, kctl->id.name);
snd_ctl_free_one(kctl);
return;
}
if (control == UAC_FU_VOLUME) { if (control == UAC_FU_VOLUME) {
check_mapped_dB(map, cval); check_mapped_dB(map, cval);
if (cval->dBmin < cval->dBmax || !cval->initialized) { if (cval->dBmin < cval->dBmax || !cval->initialized) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment