summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2020-08-25 16:58:52 -0700
committerMark Brown <broonie@kernel.org>2020-08-26 12:44:08 +0100
commite9157a449aa3f72fdbded9ce780c666bf0951cf3 (patch)
tree436a4744e6bc206c02c912cde25473db13636a1f
parent76ab546cd8f0c64d4603b2faad4558c5b670561e (diff)
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 <karolx.trzcinski@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20200825235854.1588034-3-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/sof/loader.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c
index 25dc28ebafb7..42e0e3e58869 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;