提交 cce4aa37 编写于 作者: T 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: NTakashi Iwai <tiwai@suse.de>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册