Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cce4aa37 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda/realtek - Fix Oops in alc_mux_select()



When no imux is available (e.g. a single capture source),
alc_auto_init_input_src() may trigger an Oops due to the access to -1.
Add a proper zero-check to avoid it.

Cc: <stable@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent fc084e0b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -297,6 +297,8 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
	imux = &spec->input_mux[mux_idx];
	if (!imux->num_items && mux_idx > 0)
		imux = &spec->input_mux[0];
	if (!imux->num_items)
		return 0;

	if (idx >= imux->num_items)
		idx = imux->num_items - 1;