[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231211135908.385694-4-sashal@kernel.org>
Date: Mon, 11 Dec 2023 08:57:38 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Kamil Duljas <kamil.duljas@...il.com>,
Amadeusz Sławiński
<amadeuszx.slawinski@...ux.intel.com>,
Mark Brown <broonie@...nel.org>,
Sasha Levin <sashal@...nel.org>, cezary.rojewski@...el.com,
pierre-louis.bossart@...ux.intel.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, perex@...ex.cz, tiwai@...e.com,
suhui@...china.com, zhangyiqun@...tium.com.cn,
kuninori.morimoto.gx@...esas.com, alsa-devel@...a-project.org,
linux-sound@...r.kernel.org
Subject: [PATCH AUTOSEL 5.15 04/19] ASoC: Intel: Skylake: mem leak in skl register function
From: Kamil Duljas <kamil.duljas@...il.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@...il.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@...ux.intel.com>
Link: https://lore.kernel.org/r/20231116224112.2209-2-kamil.duljas@gmail.com
Signed-off-by: Mark Brown <broonie@...nel.org>
Signed-off-by: Sasha Levin <sashal@...nel.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 0d08b0269a662..af5af5be42f68 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -1467,6 +1467,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;
}
@@ -1479,8 +1480,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
Powered by blists - more mailing lists