Commit cce4aa37 authored by Takashi Iwai's avatar Takashi Iwai

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
...@@ -297,6 +297,8 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, ...@@ -297,6 +297,8 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
imux = &spec->input_mux[mux_idx]; imux = &spec->input_mux[mux_idx];
if (!imux->num_items && mux_idx > 0) if (!imux->num_items && mux_idx > 0)
imux = &spec->input_mux[0]; imux = &spec->input_mux[0];
if (!imux->num_items)
return 0;
if (idx >= imux->num_items) if (idx >= imux->num_items)
idx = imux->num_items - 1; idx = imux->num_items - 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