diff options
author | Takashi Iwai <tiwai@suse.de> | 2020-02-14 15:49:28 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-10-01 13:17:34 +0200 |
commit | e2d439c2000d0236fdb3218545e3144ad3463076 (patch) | |
tree | 5fe84ce03016d69c9db84f155059700b5b913475 | |
parent | 78344a4dc43ed1976bf11e418163c1d44d40954c (diff) |
ALSA: usb-audio: Don't create a mixer element with bogus volume range
[ Upstream commit e9a0ef0b5ddcbc0d56c65aefc0f18d16e6f71207 ]
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.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | sound/usb/mixer.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 9079c380228f..8aa96ed0b1b5 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -1684,6 +1684,16 @@ static void __build_feature_ctl(struct usb_mixer_interface *mixer, /* get min/max values */ 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) { check_mapped_dB(map, cval); if (cval->dBmin < cval->dBmax || !cval->initialized) { |