devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ASoC: core: double free in snd_soc_add_platform()
@ 2013-07-22  6:56 Dan Carpenter
  2013-07-22 10:00 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-07-22  6:56 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: alsa-devel, Takashi Iwai, devicetree-discuss, kernel-janitors,
	Rob Herring, Mark Brown, Grant Likely

There are three callers for this function, and none of them want it to
free platform for them.  It leads to a double free.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 0ec070c..d82ee38 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3908,10 +3908,8 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
 {
 	/* create platform component name */
 	platform->name = fmt_single_name(dev, &platform->id);
-	if (platform->name == NULL) {
-		kfree(platform);
+	if (platform->name == NULL)
 		return -ENOMEM;
-	}
 
 	platform->dev = dev;
 	platform->driver = platform_drv;

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

* Re: [patch] ASoC: core: double free in snd_soc_add_platform()
  2013-07-22  6:56 [patch] ASoC: core: double free in snd_soc_add_platform() Dan Carpenter
@ 2013-07-22 10:00 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-07-22 10:00 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: alsa-devel, Takashi Iwai, devicetree-discuss, kernel-janitors,
	Liam Girdwood, Rob Herring, Grant Likely


[-- Attachment #1.1: Type: text/plain, Size: 208 bytes --]

On Mon, Jul 22, 2013 at 09:56:54AM +0300, Dan Carpenter wrote:
> There are three callers for this function, and none of them want it to
> free platform for them.  It leads to a double free.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2013-07-22 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-22  6:56 [patch] ASoC: core: double free in snd_soc_add_platform() Dan Carpenter
2013-07-22 10:00 ` Mark Brown

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).