diff options
author | Dinghao Liu <dinghao.liu@zju.edu.cn> | 2020-08-13 16:41:10 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-08-26 10:31:04 +0200 |
commit | 6b2dd0c04bb889a88fbf92f2480f295d36e61ec9 (patch) | |
tree | 40459270c8eb7b1307523ff6305ec3c936815c10 /sound/soc/intel/atom/sst-mfld-platform-pcm.c | |
parent | bd79b3b960f26209bf3c06067d8909bf93831564 (diff) | |
download | linux-stable-6b2dd0c04bb889a88fbf92f2480f295d36e61ec9.tar.gz linux-stable-6b2dd0c04bb889a88fbf92f2480f295d36e61ec9.tar.bz2 linux-stable-6b2dd0c04bb889a88fbf92f2480f295d36e61ec9.zip |
ASoC: intel: Fix memleak in sst_media_open
[ Upstream commit 062fa09f44f4fb3776a23184d5d296b0c8872eb9 ]
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@zju.edu.cn>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200813084112.26205-1-dinghao.liu@zju.edu.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound/soc/intel/atom/sst-mfld-platform-pcm.c')
-rw-r--r-- | sound/soc/intel/atom/sst-mfld-platform-pcm.c | 5 |
1 files 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 6868e71e3a3f..0572c3c96450 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -339,7 +339,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, @@ -348,8 +348,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; } |