Skip to content

Commit 6b2dd0c

Browse files
dinghaoliugregkh
authored andcommitted
ASoC: intel: Fix memleak in sst_media_open
[ Upstream commit 062fa09 ] 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: 0121327 ("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>
1 parent bd79b3b commit 6b2dd0c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

sound/soc/intel/atom/sst-mfld-platform-pcm.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ static int sst_media_open(struct snd_pcm_substream *substream,
339339

340340
ret_val = power_up_sst(stream);
341341
if (ret_val < 0)
342-
return ret_val;
342+
goto out_power_up;
343343

344344
/* Make sure, that the period size is always even */
345345
snd_pcm_hw_constraint_step(substream->runtime, 0,
@@ -348,8 +348,9 @@ static int sst_media_open(struct snd_pcm_substream *substream,
348348
return snd_pcm_hw_constraint_integer(runtime,
349349
SNDRV_PCM_HW_PARAM_PERIODS);
350350
out_ops:
351-
kfree(stream);
352351
mutex_unlock(&sst_lock);
352+
out_power_up:
353+
kfree(stream);
353354
return ret_val;
354355
}
355356

0 commit comments

Comments
 (0)