All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: alsa-devel@alsa-project.org, Zeng Zhaoming <b32542@freescale.com>,
	Takashi Iwai <tiwai@suse.de>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	kernel-janitors@vger.kernel.org
Subject: [patch] ASoC: sgtl5000: use after free in ldo_regulator_register()
Date: Tue, 8 Mar 2011 14:39:24 +0300	[thread overview]
Message-ID: <20110308113924.GC3416@bicker> (raw)

The "ldo" variable was dereferenced after free on the error path.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index b7e97c0..1f7217f 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -875,11 +875,13 @@ static int ldo_regulator_register(struct snd_soc_codec *codec,
 	ldo->dev = regulator_register(&ldo->desc, codec->dev,
 					  init_data, ldo);
 	if (IS_ERR(ldo->dev)) {
+		int ret = PTR_ERR(ldo->dev);
+
 		dev_err(codec->dev, "failed to register regulator\n");
 		kfree(ldo->desc.name);
 		kfree(ldo);
 
-		return PTR_ERR(ldo->dev);
+		return ret;
 	}
 
 	return 0;

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: alsa-devel@alsa-project.org, Zeng Zhaoming <b32542@freescale.com>,
	Takashi Iwai <tiwai@suse.de>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	kernel-janitors@vger.kernel.org
Subject: [patch] ASoC: sgtl5000: use after free in ldo_regulator_register()
Date: Tue, 08 Mar 2011 11:39:24 +0000	[thread overview]
Message-ID: <20110308113924.GC3416@bicker> (raw)

The "ldo" variable was dereferenced after free on the error path.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index b7e97c0..1f7217f 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -875,11 +875,13 @@ static int ldo_regulator_register(struct snd_soc_codec *codec,
 	ldo->dev = regulator_register(&ldo->desc, codec->dev,
 					  init_data, ldo);
 	if (IS_ERR(ldo->dev)) {
+		int ret = PTR_ERR(ldo->dev);
+
 		dev_err(codec->dev, "failed to register regulator\n");
 		kfree(ldo->desc.name);
 		kfree(ldo);
 
-		return PTR_ERR(ldo->dev);
+		return ret;
 	}
 
 	return 0;

             reply	other threads:[~2011-03-08 11:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-08 11:39 Dan Carpenter [this message]
2011-03-08 11:39 ` [patch] ASoC: sgtl5000: use after free in ldo_regulator_register() Dan Carpenter
2011-03-08 18:00 ` Liam Girdwood
2011-03-08 18:00   ` [alsa-devel] [patch] ASoC: sgtl5000: use after free in Liam Girdwood
2011-03-08 18:57 ` [patch] ASoC: sgtl5000: use after free in ldo_regulator_register() Mark Brown
2011-03-08 18:57   ` [patch] ASoC: sgtl5000: use after free in Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110308113924.GC3416@bicker \
    --to=error27@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=b32542@freescale.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.