Skip to content

Commit 2d218b4

Browse files
Chao Songbroonie
authored andcommitted
ASoC: SOF: ipc4-pcm: fix possible null pointer deference
The call to snd_sof_find_spcm_dai() could return NULL, add nullable check for the return value to avoid null pointer defenrece. Fixes: 7cb1900 ("ASoC: SOF: ipc4-pcm: add hw_params") Signed-off-by: Chao Song <chao.song@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230816133311.7523-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 0fc7769 commit 2d218b4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sound/soc/sof/ipc4-pcm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,9 @@ static int sof_ipc4_pcm_hw_params(struct snd_soc_component *component,
708708
struct snd_sof_pcm *spcm;
709709

710710
spcm = snd_sof_find_spcm_dai(component, rtd);
711+
if (!spcm)
712+
return -EINVAL;
713+
711714
time_info = spcm->stream[substream->stream].private;
712715
/* delay calculation is not supported by current fw_reg ABI */
713716
if (!time_info)

0 commit comments

Comments
 (0)