[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250402141411.44972-1-bsdhenrymartin@gmail.com>
Date: Wed, 2 Apr 2025 22:14:11 +0800
From: Henry Martin <bsdhenrymartin@...il.com>
To: cezary.rojewski@...el.com,
liam.r.girdwood@...ux.intel.com,
peter.ujfalusi@...ux.intel.com,
yung-chuan.liao@...ux.intel.com,
ranjani.sridharan@...ux.intel.com,
kai.vehmanen@...ux.intel.com
Cc: pierre-louis.bossart@...ux.dev,
broonie@...nel.org,
perex@...ex.cz,
tiwai@...e.com,
amadeuszx.slawinski@...ux.intel.com,
ethan@...ancedwards.com,
jbrunet@...libre.com,
bsdhenrymartin@...il.com,
linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] ASoC: Intel: avs: Fix null-ptr-deref in avs_component_probe()
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.
Fixes: 739c031110da ("ASoC: Intel: avs: Provide support for fallback topology")
Reviewed-by: Cezary Rojewski <cezary.rojewski@...el.com>
Reviewed-by: Ethan Carter Edwards <ethan@...ancedwards.com>
Signed-off-by: Henry Martin <bsdhenrymartin@...il.com>
---
V1 -> V2: No functional changes, just correct title and redundant commit
message.
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
Powered by blists - more mailing lists