ASoC: dapm: Potential small memory leak in dapm_cnew_widget()
Subsystems (3)
PATCH 1/1 ASoC: dapm: Potential small memory leak in dapm_cnew_widget()
We should free "w" on the error path.
--- sound/soc/soc-dapm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/soc-dapm.c +3 -1
@@ -332,8 +332,10 @@ static inline struct snd_soc_dapm_widget *dapm_cnew_widget(*/ if (_widget->sname) { w->sname =kstrdup_const (_widget->sname,GFP_KERNEL ); -if (!w->sname) +if (!w->sname) { +kfree (w);return NULL ; + } }return w; }
Signature · 1 line
2.17.1
Mark Brown
maintainerApplied "ASoC: dapm: Potential small memory leak in dapm_cnew_widget()" to the asoc tree
The patch
ASoC: dapm: Potential small memory leak in dapm_cnew_widget()
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
From a6d9cef30eb11b2de8cbfed9065e3dc5b1f829a8 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <[email protected]>
Date: Tue, 19 Feb 2019 15:04:27 +0300
Subject: [PATCH] ASoC: dapm: Potential small memory leak in dapm_cnew_widget()
We should free "w" on the error path.
--- sound/soc/soc-dapm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/soc-dapm.c +3 -1
@@ -332,8 +332,10 @@ static inline struct snd_soc_dapm_widget *dapm_cnew_widget(*/ if (_widget->sname) { w->sname =kstrdup_const (_widget->sname,GFP_KERNEL ); -if (!w->sname) +if (!w->sname) { +kfree (w);return NULL ; + } }return w; }
Signature · 1 line
2.20.1
Quoted 4 lines · Dan Carpenter
We should free "w" on the error path.
Fixes 199ed3e81c49 ("ASoC: dapm: fix use-after-free issue with dailink sname")Signed-off-by Dan Carpenter <[email protected]>
Good catch, thanks.
Quoted 20 lines
--- sound/soc/soc-dapm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)sound/soc/soc-dapm.c +3
-1@@ -332,8 +332,10 @@ static inline struct snd_soc_dapm_widget *dapm_cnew_widget(*/ if (_widget->sname) { w->sname =kstrdup_const (_widget->sname,GFP_KERNEL ); -if (!w->sname) +if (!w->sname) { +kfree (w);return NULL ; + } }return w; }