Skip to content

Commit 6b540ac

Browse files
kv2019ibroonie
authored andcommitted
ASoC: Intel: sof_sdw: avoid crash if invalid DSP topology loaded
The mc_private->hdmi_pcm_list is populated by elements loaded during DSP topology load. Valid topologies for this machine driver will always have PCM nodes for HDMI, but driver should fail gracefully even in the case this is not true. Add a sanity check to sof_sdw_hdmi_card_late_probe() for this case. Without the fix, a null pcm handle gets dereferenced. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@linux.intel.com> Link: https://lore.kernel.org/r/20200717211337.31956-5-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 15ef2ea commit 6b540ac

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sound/soc/intel/boards/sof_sdw_hdmi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card)
5555
if (!ctx->idisp_codec)
5656
return 0;
5757

58+
if (list_empty(&ctx->hdmi_pcm_list))
59+
return -EINVAL;
60+
5861
pcm = list_first_entry(&ctx->hdmi_pcm_list, struct hdmi_pcm,
5962
head);
6063
component = pcm->codec_dai->component;

0 commit comments

Comments
 (0)