]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ASoC: core: Check for rtd == NULL in snd_soc_remove_pcm_runtime()
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Thu, 19 Jun 2025 08:42:20 +0000 (11:42 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 19 Jun 2025 12:19:14 +0000 (13:19 +0100)
snd_soc_remove_pcm_runtime() might be called with rtd == NULL which will
leads to null pointer dereference.
This was reproduced with topology loading and marking a link as ignore
due to missing hardware component on the system.
On module removal the soc_tplg_remove_link() would call
snd_soc_remove_pcm_runtime() with rtd == NULL since the link was ignored,
no runtime was created.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://patch.msgid.link/20250619084222.559-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-core.c

index cfafdabcdc888f3b3941d6bb379d80131f34c5af..1ffabac1fb6b1f6a0cbe9a38f33f5330eda4c87c 100644 (file)
@@ -1139,6 +1139,9 @@ sanity_check:
 void snd_soc_remove_pcm_runtime(struct snd_soc_card *card,
                                struct snd_soc_pcm_runtime *rtd)
 {
+       if (!rtd)
+               return;
+
        lockdep_assert_held(&client_mutex);
 
        /*