Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ca320e2 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Fix NULL dereference with CONFIG_SND_DYNAMIC_MINORS=n



Without the dynamic minor assignment, HDMI codec may have less PCM
instances than the number of pins, which eventually leads to Oops.

Reported-by: default avatarStratos Karafotis <stratosk@semaphore.gr>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d3d3835c
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -1781,6 +1781,9 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
		struct snd_pcm_chmap *chmap;
		struct snd_pcm_chmap *chmap;
		struct snd_kcontrol *kctl;
		struct snd_kcontrol *kctl;
		int i;
		int i;

		if (!codec->pcm_info[pin_idx].pcm)
			break;
		err = snd_pcm_add_chmap_ctls(codec->pcm_info[pin_idx].pcm,
		err = snd_pcm_add_chmap_ctls(codec->pcm_info[pin_idx].pcm,
					     SNDRV_PCM_STREAM_PLAYBACK,
					     SNDRV_PCM_STREAM_PLAYBACK,
					     NULL, 0, pin_idx, &chmap);
					     NULL, 0, pin_idx, &chmap);