Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH v1] ASoC: Intel: avs: Add NULL check in avs_component_probe()
@ 2025-04-01 14:32 Henry Martin
  2025-04-02 12:00 ` [PATCH] " Markus Elfring
  2025-04-02 13:59 ` [PATCH v1] " Cezary Rojewski
  0 siblings, 2 replies; 10+ messages in thread
From: Henry Martin @ 2025-04-01 14:32 UTC (permalink / raw)
  To: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
	ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, broonie,
	perex, tiwai
  Cc: amadeuszx.slawinski, ethan, jbrunet, krzysztof.kozlowski,
	linux-sound, linux-kernel, Henry Martin

devm_kasprintf() returns NULL when memory allocation fails. Currently,
avs_component_probe() does not check for this case, which results in a
NULL pointer dereference.

Add NULL check after devm_kasprintf() to prevent this issue.

Fixes: 739c031110da ("ASoC: Intel: avs: Provide support for fallback topology")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
---
 sound/soc/intel/avs/pcm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index dac463390da1..7072bcf4e56f 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -927,7 +927,8 @@ static int avs_component_probe(struct snd_soc_component *component)
 		else
 			mach->tplg_filename = devm_kasprintf(adev->dev, GFP_KERNEL,
 							     "hda-generic-tplg.bin");
-
+		if (!mach->tplg_filename)
+			return -ENOMEM;
 		filename = kasprintf(GFP_KERNEL, "%s/%s", component->driver->topology_name_prefix,
 				     mach->tplg_filename);
 		if (!filename)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-04-07 23:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 14:32 [PATCH v1] ASoC: Intel: avs: Add NULL check in avs_component_probe() Henry Martin
2025-04-02 12:00 ` [PATCH] " Markus Elfring
2025-04-02 13:34   ` Ethan Carter Edwards
2025-04-02 14:42     ` Markus Elfring
2025-04-02 14:14   ` [PATCH] " Mark Brown
2025-04-02 13:59 ` [PATCH v1] " Cezary Rojewski
2025-04-02 14:14   ` [PATCH v2] ASoC: Intel: avs: Fix null-ptr-deref " Henry Martin
2025-04-02 19:18     ` Markus Elfring
2025-04-02 19:56       ` Mark Brown
2025-04-07 23:48     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox