ALSA: hda - Fix NULL-derefence with a single mic in STAC auto-mic detection
authorTakashi Iwai <tiwai@suse.de>
Thu, 13 Jan 2011 07:08:08 +0000 (08:08 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 13 Jan 2011 07:29:12 +0000 (08:29 +0100)
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=25692

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: <stable@kernel.org>
sound/pci/hda/patch_sigmatel.c

index c8d812ecb943ec2fe3b610d2bced911ac4def183..4ab019d0924eb7bdbfdc3e890d08727cf7e6f0a0 100644 (file)
@@ -3594,7 +3594,7 @@ static int stac_check_auto_mic(struct hda_codec *codec)
                if (check_mic_pin(codec, spec->dmic_nids[i],
                    &fixed, &ext, &dock))
                        return 0;
-       if (!fixed && !ext && !dock)
+       if (!fixed || (!ext && !dock))
                return 0; /* no input to switch */
        if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
                return 0; /* no unsol support */