[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231211140254.392656-1-sashal@kernel.org>
Date: Mon, 11 Dec 2023 09:02:44 -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, kuninori.morimoto.gx@...esas.com,
zhangyiqun@...tium.com.cn, alsa-devel@...a-project.org,
linux-sound@...r.kernel.org
Subject: [PATCH AUTOSEL 4.19 1/7] 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 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
Powered by blists - more mailing lists