summaryrefslogtreecommitdiff
path: root/sound/soc/sof/ipc.c
diff options
context:
space:
mode:
authorAjit Kumar Pandey <AjitKumar.Pandey@amd.com>2021-12-16 17:24:21 -0600
committerMark Brown <broonie@kernel.org>2021-12-17 11:06:18 +0000
commit182b682b9ab1348e07ea1bf9d8f2505cc67f9237 (patch)
tree5396defd8d855508947113b79c4c925240ccd684 /sound/soc/sof/ipc.c
parentcb515f105cab124c5740e70dd0e8c78186ae81b7 (diff)
downloadlinux-next-182b682b9ab1348e07ea1bf9d8f2505cc67f9237.tar.gz
ASoC: SOF: ipc: Add null pointer check for substream->runtime
When pcm stream is stopped "substream->runtime" pointer will be set to NULL by ALSA core. In case host received an ipc msg from firmware of type IPC_STREAM_POSITION after pcm stream is stopped, there will be kernel NULL pointer exception in ipc_period_elapsed(). This patch fixes it by adding NULL pointer check for "substream->runtime". Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20211216232422.345164-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/ipc.c')
-rw-r--r--sound/soc/sof/ipc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c
index 8a1eacc7ec5f..12860da1d373 100644
--- a/sound/soc/sof/ipc.c
+++ b/sound/soc/sof/ipc.c
@@ -623,7 +623,8 @@ static void ipc_period_elapsed(struct snd_sof_dev *sdev, u32 msg_id)
if (spcm->pcm.compress)
snd_sof_compr_fragment_elapsed(stream->cstream);
- else if (!stream->substream->runtime->no_period_wakeup)
+ else if (stream->substream->runtime &&
+ !stream->substream->runtime->no_period_wakeup)
/* only inform ALSA for period_wakeup mode */
snd_sof_pcm_period_elapsed(stream->substream);
}