]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ALSA: usb-audio: Fix missing error check at mixer resolution test
authorTakashi Iwai <tiwai@suse.de>
Sat, 9 Nov 2019 18:16:58 +0000 (19:16 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 19 Dec 2019 15:58:59 +0000 (15:58 +0000)
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
Link: https://lore.kernel.org/r/20191109181658.30368-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/usb/mixer.c

index 158c84b7910391fb9904dd68b613bbbeba606e5e..68774e172a66cd24d4edd9ef9116ea4ca144d415 100644 (file)
@@ -1014,7 +1014,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)
@@ -1034,6 +1035,7 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
                        set_cur_mix_value(cval, minchn, 0, saved);
                }
 
+no_res_check:
                cval->initialized = 1;
        }