[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231211135457.381397-7-sashal@kernel.org>
Date: Mon, 11 Dec 2023 08:53:51 -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,
kuninori.morimoto.gx@...esas.com, suhui@...china.com,
zhangyiqun@...tium.com.cn, alsa-devel@...a-project.org,
linux-sound@...r.kernel.org
Subject: [PATCH AUTOSEL 6.1 07/29] 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 7ef0041075130..adee4be2dea71 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -1473,6 +1473,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;
}
@@ -1485,8 +1486,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