From: Pierre-Louis Bossart Date: Tue, 25 Aug 2020 23:58:52 +0000 (-0700) Subject: ASoC: SOF: loader: fix memory leak in get_ext_windows X-Git-Tag: v5.15~2323^2~3^2~167 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9157a449aa3f72fdbded9ce780c666bf0951cf3;p=platform%2Fkernel%2Flinux-starfive.git ASoC: SOF: loader: fix memory leak in get_ext_windows sdev->info_window is allocated with kmemdup and never freed, use devm_ version since this is only used for first boot. Fixes: 8d809c15acf23 ('ASoC: SOF: ext_manifest: parse windows') Cc: Karol Trzcinski Signed-off-by: Pierre-Louis Bossart Reviewed-by: Daniel Baluta Reviewed-by: Kai Vehmanen Reviewed-by: Rander Wang Reviewed-by: Guennadi Liakhovetski Reviewed-by: Bard Liao Signed-off-by: Ranjani Sridharan Link: https://lore.kernel.org/r/20200825235854.1588034-3-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c index 25dc28e..42e0e3e 100644 --- a/sound/soc/sof/loader.c +++ b/sound/soc/sof/loader.c @@ -33,7 +33,8 @@ static int get_ext_windows(struct snd_sof_dev *sdev, } /* keep a local copy of the data */ - sdev->info_window = kmemdup(w, ext_hdr->hdr.size, GFP_KERNEL); + sdev->info_window = devm_kmemdup(sdev->dev, w, ext_hdr->hdr.size, + GFP_KERNEL); if (!sdev->info_window) return -ENOMEM;