summary refs log tree commit diff
path: root/sound/hda/hdac_stream.c
diff options
context:
space:
mode:
authorMariusz Ceier <mceier+kernel@gmail.com>2019-03-11 21:53:57 +0100
committerTakashi Iwai <tiwai@suse.de>2019-03-13 11:23:59 +0100
commitd344e07940f3a3a93dec38f36593cca1591a7a5e (patch)
treead54bef7105d84ecbef28cf74db7b620987d4942 /sound/hda/hdac_stream.c
parenta634090a0f242caa8ebc91967b118995a80eb13b (diff)
downloadlinux-d344e07940f3a3a93dec38f36593cca1591a7a5e.tar.gz
ALSA: hda: Avoid NULL pointer dereference at snd_hdac_stream_start()
For ca0132 codec, azx_dev->stream is NULL during firmware loading.
Calling snd_hdac_get_stream_stripe_ctl unconditionally causes NULL
pointer dereference in that function.

Fixes: 9b6f7e7a296e ("ALSA: hda: program stripe bits for controller")
Signed-off-by: Mariusz Ceier <mceier+kernel@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/hda/hdac_stream.c')
-rw-r--r--sound/hda/hdac_stream.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
index f5dd288d1a7a..76e9b41fcea2 100644
--- a/sound/hda/hdac_stream.c
+++ b/sound/hda/hdac_stream.c
@@ -95,7 +95,10 @@ void snd_hdac_stream_start(struct hdac_stream *azx_dev, bool fresh_start)
 			      1 << azx_dev->index,
 			      1 << azx_dev->index);
 	/* set stripe control */
-	stripe_ctl = snd_hdac_get_stream_stripe_ctl(bus, azx_dev->substream);
+	if (azx_dev->substream)
+		stripe_ctl = snd_hdac_get_stream_stripe_ctl(bus, azx_dev->substream);
+	else
+		stripe_ctl = 0;
 	snd_hdac_stream_updateb(azx_dev, SD_CTL_3B, SD_CTL_STRIPE_MASK,
 				stripe_ctl);
 	/* set DMA start and interrupt mask */