summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-11-09 19:16:58 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-20 17:59:27 +0100
commit524c3eacd7bbc92f255c98e1b0a8b824b0ebb5d0 (patch)
treeead3923b529eccb2d424a3b3d5cdd371ca45a8e6 /sound
parent82ea5a1742e22638db3e3bb812e2e2b1eaf6b661 (diff)
ALSA: usb-audio: Fix missing error check at mixer resolution test
commit 167beb1756791e0806365a3f86a0da10d7a327ee upstream. A check of the return value from get_cur_mix_raw() is missing at the resolution test code in get_min_max_with_quirks(), which may leave the variable untouched, leading to a random uninitialized value, as detected by syzkaller fuzzer. Add the missing return error check for fixing that. Reported-and-tested-by: syzbot+abe1ab7afc62c6bb6377@syzkaller.appspotmail.com Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20191109181658.30368-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/mixer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 5d48f8e74c56..044193b2364d 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1052,7 +1052,8 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
if (cval->min + cval->res < cval->max) {
int last_valid_res = cval->res;
int saved, test, check;
- get_cur_mix_raw(cval, minchn, &saved);
+ if (get_cur_mix_raw(cval, minchn, &saved) < 0)
+ goto no_res_check;
for (;;) {
test = saved;
if (test < cval->max)
@@ -1072,6 +1073,7 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
snd_usb_set_cur_mix_value(cval, minchn, 0, saved);
}
+no_res_check:
cval->initialized = 1;
}