Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ajit Kumar Pandey and committed by
Mark Brown
182b682b cb515f10

+2 -1
+2 -1
sound/soc/sof/ipc.c
··· 623 623 624 624 if (spcm->pcm.compress) 625 625 snd_sof_compr_fragment_elapsed(stream->cstream); 626 - else if (!stream->substream->runtime->no_period_wakeup) 626 + else if (stream->substream->runtime && 627 + !stream->substream->runtime->no_period_wakeup) 627 628 /* only inform ALSA for period_wakeup mode */ 628 629 snd_sof_pcm_period_elapsed(stream->substream); 629 630 }