kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: dapm: Potential small memory leak in dapm_cnew_widget()
@ 2019-02-19 12:04 Dan Carpenter
  2019-02-19 15:50 ` Applied "ASoC: dapm: Potential small memory leak in dapm_cnew_widget()" to the asoc tree Mark Brown
  2019-02-19 15:59 ` [alsa-devel] [PATCH] ASoC: dapm: Potential small memory leak in dapm_cnew_widget() Pierre-Louis Bossart
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-02-19 12:04 UTC (permalink / raw)
  To: Liam Girdwood, Pierre-Louis Bossart
  Cc: alsa-devel, Mark Brown, kernel-janitors, Takashi Iwai

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 <dan.carpenter@oracle.com>
---
 sound/soc/soc-dapm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index dea6fc2353e4..1ec06ef6d161 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -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;
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Applied "ASoC: dapm: Potential small memory leak in dapm_cnew_widget()" to the asoc tree
  2019-02-19 12:04 [PATCH] ASoC: dapm: Potential small memory leak in dapm_cnew_widget() Dan Carpenter
@ 2019-02-19 15:50 ` Mark Brown
  2019-02-19 15:59 ` [alsa-devel] [PATCH] ASoC: dapm: Potential small memory leak in dapm_cnew_widget() Pierre-Louis Bossart
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2019-02-19 15:50 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Pierre-Louis Bossart, alsa-devel, kernel-janitors, Takashi Iwai,
	Liam Girdwood, Mark Brown

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 <dan.carpenter@oracle.com>
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.

Fixes: 199ed3e81c49 ("ASoC: dapm: fix use-after-free issue with dailink sname")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/soc-dapm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index dea6fc2353e4..1ec06ef6d161 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -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;
 }
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [alsa-devel] [PATCH] ASoC: dapm: Potential small memory leak in dapm_cnew_widget()
  2019-02-19 12:04 [PATCH] ASoC: dapm: Potential small memory leak in dapm_cnew_widget() Dan Carpenter
  2019-02-19 15:50 ` Applied "ASoC: dapm: Potential small memory leak in dapm_cnew_widget()" to the asoc tree Mark Brown
@ 2019-02-19 15:59 ` Pierre-Louis Bossart
  1 sibling, 0 replies; 3+ messages in thread
From: Pierre-Louis Bossart @ 2019-02-19 15:59 UTC (permalink / raw)
  To: Dan Carpenter, Liam Girdwood
  Cc: alsa-devel, Mark Brown, kernel-janitors, Takashi Iwai


On 2/19/19 6:04 AM, Dan Carpenter wrote:
> 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 <dan.carpenter@oracle.com>

Good catch, thanks.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>


> ---
>   sound/soc/soc-dapm.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index dea6fc2353e4..1ec06ef6d161 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -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;
>   }

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-19 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-19 12:04 [PATCH] ASoC: dapm: Potential small memory leak in dapm_cnew_widget() Dan Carpenter
2019-02-19 15:50 ` Applied "ASoC: dapm: Potential small memory leak in dapm_cnew_widget()" to the asoc tree Mark Brown
2019-02-19 15:59 ` [alsa-devel] [PATCH] ASoC: dapm: Potential small memory leak in dapm_cnew_widget() Pierre-Louis Bossart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).