Skip to content

Commit 167beb1

Browse files
committed
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: [email protected] Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent df37d94 commit 167beb1

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
@@ -1229,7 +1229,8 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
12291229
if (cval->min + cval->res < cval->max) {
12301230
int last_valid_res = cval->res;
12311231
int saved, test, check;
1232-
get_cur_mix_raw(cval, minchn, &saved);
1232+
if (get_cur_mix_raw(cval, minchn, &saved) < 0)
1233+
goto no_res_check;
12331234
for (;;) {
12341235
test = saved;
12351236
if (test < cval->max)
@@ -1249,6 +1250,7 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
12491250
snd_usb_set_cur_mix_value(cval, minchn, 0, saved);
12501251
}
12511252

1253+
no_res_check:
12521254
cval->initialized = 1;
12531255
}
12541256

0 commit comments

Comments
 (0)