public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.19 1/7] ASoC: Intel: Skylake: mem leak in skl register function
@ 2023-12-11 14:02 Sasha Levin
  2023-12-11 14:02 ` [PATCH AUTOSEL 4.19 2/7] ASoC: cs43130: Fix the position of const qualifier Sasha Levin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sasha Levin @ 2023-12-11 14:02 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Kamil Duljas, Amadeusz Sławiński, Mark Brown,
	Sasha Levin, cezary.rojewski, pierre-louis.bossart,
	liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
	ranjani.sridharan, kai.vehmanen, perex, tiwai, suhui,
	kuninori.morimoto.gx, zhangyiqun, alsa-devel, linux-sound

From: Kamil Duljas <kamil.duljas@gmail.com>

[ Upstream commit f8ba14b780273fd290ddf7ee0d7d7decb44cc365 ]

skl_platform_register() uses krealloc. When krealloc is fail,
then previous memory is not freed. The leak is also when soc
component registration failed.

Signed-off-by: Kamil Duljas <kamil.duljas@gmail.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20231116224112.2209-2-kamil.duljas@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/intel/skylake/skl-pcm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 6b2c8c6e7a00f..5195e012dc6d4 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -1450,6 +1450,7 @@ int skl_platform_register(struct device *dev)
 		dais = krealloc(skl->dais, sizeof(skl_fe_dai) +
 				sizeof(skl_platform_dai), GFP_KERNEL);
 		if (!dais) {
+			kfree(skl->dais);
 			ret = -ENOMEM;
 			goto err;
 		}
@@ -1462,8 +1463,10 @@ int skl_platform_register(struct device *dev)
 
 	ret = devm_snd_soc_register_component(dev, &skl_component,
 					 skl->dais, num_dais);
-	if (ret)
+	if (ret) {
+		kfree(skl->dais);
 		dev_err(dev, "soc component registration failed %d\n", ret);
+	}
 err:
 	return ret;
 }
-- 
2.42.0


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

end of thread, other threads:[~2023-12-11 14:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-11 14:02 [PATCH AUTOSEL 4.19 1/7] ASoC: Intel: Skylake: mem leak in skl register function Sasha Levin
2023-12-11 14:02 ` [PATCH AUTOSEL 4.19 2/7] ASoC: cs43130: Fix the position of const qualifier Sasha Levin
2023-12-11 14:02 ` [PATCH AUTOSEL 4.19 3/7] ASoC: cs43130: Fix incorrect frame delay configuration Sasha Levin
2023-12-11 14:02 ` [PATCH AUTOSEL 4.19 4/7] ASoC: rt5650: add mutex to avoid the jack detection failure Sasha Levin
2023-12-11 14:02 ` [PATCH AUTOSEL 4.19 6/7] ASoC: da7219: Support low DC impedance headset Sasha Levin

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