[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0add5326-d182-c456-0f8b-1d70bb67a2fc@linux.intel.com>
Date: Thu, 13 Aug 2020 07:52:20 -0500
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: Dinghao Liu <dinghao.liu@....edu.cn>, kjlu@....edu
Cc: Cezary Rojewski <cezary.rojewski@...el.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>,
Vinod Koul <vkoul@...nel.org>,
"Subhransu S. Prusty" <subhransu.s.prusty@...el.com>,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [v2] ASoC: intel: Fix memleak in sst_media_open
On 8/13/20 3:41 AM, Dinghao Liu wrote:
> 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>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
Thanks for spotting this!
> ---
>
> Changelog:
>
> v2: - Add a new label 'out_power_up' to unify code style.
> ---
> sound/soc/intel/atom/sst-mfld-platform-pcm.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> index 49b9f18472bc..b1cac7abdc0a 100644
> --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> @@ -331,7 +331,7 @@ static int sst_media_open(struct snd_pcm_substream *substream,
>
> ret_val = power_up_sst(stream);
> if (ret_val < 0)
> - return ret_val;
> + goto out_power_up;
>
> /* Make sure, that the period size is always even */
> snd_pcm_hw_constraint_step(substream->runtime, 0,
> @@ -340,8 +340,9 @@ static int sst_media_open(struct snd_pcm_substream *substream,
> return snd_pcm_hw_constraint_integer(runtime,
> SNDRV_PCM_HW_PARAM_PERIODS);
> out_ops:
> - kfree(stream);
> mutex_unlock(&sst_lock);
> +out_power_up:
> + kfree(stream);
> return ret_val;
> }
>
>
Powered by blists - more mailing lists