[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200809085654.16483-1-dinghao.liu@zju.edu.cn>
Date: Sun, 9 Aug 2020 16:56:52 +0800
From: Dinghao Liu <dinghao.liu@....edu.cn>
To: dinghao.liu@....edu.cn, kjlu@....edu
Cc: Cezary Rojewski <cezary.rojewski@...el.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Liam Girdwood <liam.r.girdwood@...ux.intel.com>,
Jie Yang <yang.jie@...ux.intel.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
"Subhransu S. Prusty" <subhransu.s.prusty@...el.com>,
Vinod Koul <vkoul@...nel.org>, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] ASoC: intel: Fix memleak in sst_media_open
When power_up_sst() fails, stream needs to be freed
just like when try_module_get() fails. However, current
code is returning directly and ends up leaking memory.
Fixes: 0121327c1a68b ("ASoC: Intel: mfld-pcm: add control for powering up/down dsp")
Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
---
sound/soc/intel/atom/sst-mfld-platform-pcm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
index 49b9f18472bc..79fedf9e3da1 100644
--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
@@ -330,8 +330,10 @@ static int sst_media_open(struct snd_pcm_substream *substream,
runtime->private_data = stream;
ret_val = power_up_sst(stream);
- if (ret_val < 0)
+ if (ret_val < 0) {
+ kfree(stream);
return ret_val;
+ }
/* Make sure, that the period size is always even */
snd_pcm_hw_constraint_step(substream->runtime, 0,
--
2.17.1
Powered by blists - more mailing lists