Commit 167beb17 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usb-audio: Fix missing error check at mixer resolution test

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.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent df37d941
...@@ -1229,7 +1229,8 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval, ...@@ -1229,7 +1229,8 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
if (cval->min + cval->res < cval->max) { if (cval->min + cval->res < cval->max) {
int last_valid_res = cval->res; int last_valid_res = cval->res;
int saved, test, check; 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 (;;) { for (;;) {
test = saved; test = saved;
if (test < cval->max) if (test < cval->max)
...@@ -1249,6 +1250,7 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval, ...@@ -1249,6 +1250,7 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
snd_usb_set_cur_mix_value(cval, minchn, 0, saved); snd_usb_set_cur_mix_value(cval, minchn, 0, saved);
} }
no_res_check:
cval->initialized = 1; cval->initialized = 1;
} }
......
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