Skip to content

Commit 524c3ea

Browse files
tiwaigregkh
authored andcommitted
ALSA: usb-audio: Fix missing error check at mixer resolution test
commit 167beb1 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: [email protected] Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 82ea5a1 commit 524c3ea

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sound/usb/mixer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,8 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
10521052
if (cval->min + cval->res < cval->max) {
10531053
int last_valid_res = cval->res;
10541054
int saved, test, check;
1055-
get_cur_mix_raw(cval, minchn, &saved);
1055+
if (get_cur_mix_raw(cval, minchn, &saved) < 0)
1056+
goto no_res_check;
10561057
for (;;) {
10571058
test = saved;
10581059
if (test < cval->max)
@@ -1072,6 +1073,7 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
10721073
snd_usb_set_cur_mix_value(cval, minchn, 0, saved);
10731074
}
10741075

1076+
no_res_check:
10751077
cval->initialized = 1;
10761078
}
10771079

0 commit comments

Comments
 (0)