Commit 80c67852 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Fix NULL-derefence with a single mic in STAC auto-mic detection

When only one mic is available and it's an analog mic, the current
IDT/STAC parser may give an Oops.

Reference: bko#25692
	https://bugzilla.kernel.org/show_bug.cgi?id=25692Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Cc: <stable@kernel.org>
parent 700b65ce
...@@ -3594,7 +3594,7 @@ static int stac_check_auto_mic(struct hda_codec *codec) ...@@ -3594,7 +3594,7 @@ static int stac_check_auto_mic(struct hda_codec *codec)
if (check_mic_pin(codec, spec->dmic_nids[i], if (check_mic_pin(codec, spec->dmic_nids[i],
&fixed, &ext, &dock)) &fixed, &ext, &dock))
return 0; return 0;
if (!fixed && !ext && !dock) if (!fixed || (!ext && !dock))
return 0; /* no input to switch */ return 0; /* no input to switch */
if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
return 0; /* no unsol support */ return 0; /* no unsol support */
......
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