* [PATCH] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids
@ 2019-09-25 4:08 Navid Emamdoost
2019-09-25 10:48 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Navid Emamdoost @ 2019-09-25 4:08 UTC (permalink / raw)
Cc: emamd001, kjlu, smccaman, Navid Emamdoost, Cezary Rojewski,
Pierre-Louis Bossart, Liam Girdwood, Jie Yang, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Greg Kroah-Hartman, Enrico Weigelt,
Andy Shevchenko, Thomas Gleixner, alsa-devel, linux-kernel
In snd_skl_parse_uuids if allocation for module->instance_id fails, the
allocated memory for module shoulde be released.
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
sound/soc/intel/skylake/skl-sst-utils.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
index d43cbf4a71ef..d4db64d72b2c 100644
--- a/sound/soc/intel/skylake/skl-sst-utils.c
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -299,6 +299,7 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
module->instance_id = devm_kzalloc(ctx->dev, size, GFP_KERNEL);
if (!module->instance_id) {
ret = -ENOMEM;
+ kfree(module);
goto free_uuid_list;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids
2019-09-25 4:08 [PATCH] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids Navid Emamdoost
@ 2019-09-25 10:48 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2019-09-25 10:48 UTC (permalink / raw)
To: Navid Emamdoost
Cc: emamd001, kjlu, smccaman, Cezary Rojewski, Pierre-Louis Bossart,
Liam Girdwood, Jie Yang, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Greg Kroah-Hartman, Enrico Weigelt, Thomas Gleixner,
alsa-devel, linux-kernel
On Tue, Sep 24, 2019 at 11:08:38PM -0500, Navid Emamdoost wrote:
> In snd_skl_parse_uuids if allocation for module->instance_id fails, the
> allocated memory for module shoulde be released.
Since it's using devm_*() for the second allocation it would be cleaner to
either switch it to regular kcalloc() or to switch the first one to
devm_kzalloc(), whatever suits better.
> module->instance_id = devm_kzalloc(ctx->dev, size, GFP_KERNEL);
> if (!module->instance_id) {
> + kfree(module);
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-25 10:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-25 4:08 [PATCH] ASoC: Intel: Skylake: prevent memory leak in snd_skl_parse_uuids Navid Emamdoost
2019-09-25 10:48 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox