From: Raymond Yau Date: Tue, 3 May 2011 05:33:53 +0000 (+0800) Subject: ALSA: hda - fix NULL-dereference in patch_realtek X-Git-Tag: firefly_0821_release~7613^2~1041^2~12^2~38 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ce85c9ac8dd53a658d85b4f39f612c23aa704e49;p=firefly-linux-kernel-4.4.55.git ALSA: hda - fix NULL-dereference in patch_realtek Fix NULL-dereference when try to use alt_playback since those codecs which support multistreaming playback usually have more than 1 adc but the driver should create alt_capture when spec->stream_analog_alt_capture is also defined. Signed-off-by: Raymond Yau Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index c9f77152e079..4dd0cccc5a9e 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4424,7 +4424,7 @@ static int alc_build_pcms(struct hda_codec *codec) alc_pcm_null_stream; info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; } - if (spec->num_adc_nids > 1) { + if (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture) { info->stream[SNDRV_PCM_STREAM_CAPTURE] = *spec->stream_analog_alt_capture; info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =