ASoC: Intel: Skylake: mem leak in skl register function
[ Upstream commit f8ba14b780
]
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>
This commit is contained in:
parent
cb6b6ff7a7
commit
ce6cce0799
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue