From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: [patch] ASoC: core: double free in snd_soc_add_platform() Date: Mon, 22 Jul 2013 09:56:54 +0300 Message-ID: <20130722065654.GC14617@longonot.mountain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Liam Girdwood Cc: alsa-devel@alsa-project.org, Takashi Iwai , devicetree-discuss@lists.ozlabs.org, kernel-janitors@vger.kernel.org, Rob Herring , Mark Brown , Grant Likely List-Id: devicetree@vger.kernel.org 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 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;