From patchwork Wed Mar 5 11:11:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 3773411 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C327D9F1EE for ; Wed, 5 Mar 2014 11:36:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DED3420251 for ; Wed, 5 Mar 2014 11:36:25 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9B2E120213 for ; Wed, 5 Mar 2014 11:36:24 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 92218265B96; Wed, 5 Mar 2014 12:36:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 69817265136; Wed, 5 Mar 2014 12:28:18 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id CCA78265136; Wed, 5 Mar 2014 12:28:17 +0100 (CET) Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) by alsa0.perex.cz (Postfix) with ESMTP id DFDFF265167 for ; Wed, 5 Mar 2014 12:15:19 +0100 (CET) Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s25BFGWY023417 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 5 Mar 2014 11:15:17 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by ucsinet22.oracle.com (8.14.5+Sun/8.14.5) with ESMTP id s25BFF7T017978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 5 Mar 2014 11:15:15 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s25BFEX2000878; Wed, 5 Mar 2014 11:15:14 GMT Received: from elgon.mountain (/41.202.233.181) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 05 Mar 2014 03:15:14 -0800 Date: Wed, 5 Mar 2014 14:11:57 +0300 From: Dan Carpenter To: Liam Girdwood Message-ID: <20140305111157.GD16926@elgon.mountain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: ucsinet22.oracle.com [156.151.31.94] Cc: alsa-devel@alsa-project.org, Takashi Iwai , kernel-janitors@vger.kernel.org, Mark Brown , Jarkko Nikula Subject: [alsa-devel] [patch] ASoC: Baytrail: fix error handling in sst_byt_dsp_init() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" 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 X-Virus-Scanned: ClamAV using ClamSMTP Calling "kfree(byt)" is a double free because that was allocated with devm_kzalloc(). There were a couple places which leak "byt->msg". That memory is allocated in msg_empty_list_init(). Fixes: f7d01fd6754c ('ASoC: Intel: Add Intel Baytrail SST DSP IPC support') Signed-off-by: Dan Carpenter Acked-by: Liam Girdwood diff --git a/sound/soc/intel/sst-baytrail-ipc.c b/sound/soc/intel/sst-baytrail-ipc.c index c12e194bbc6b..d0eaeee21be4 100644 --- a/sound/soc/intel/sst-baytrail-ipc.c +++ b/sound/soc/intel/sst-baytrail-ipc.c @@ -796,7 +796,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata) err = msg_empty_list_init(byt); if (err < 0) - goto list_err; + return -ENOMEM; /* start the IPC message thread */ init_kthread_worker(&byt->kworker); @@ -806,7 +806,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata) if (IS_ERR(byt->tx_thread)) { err = PTR_ERR(byt->tx_thread); dev_err(byt->dev, "error failed to create message TX task\n"); - goto list_err; + goto err_free_msg; } init_kthread_work(&byt->kwork, sst_byt_ipc_tx_msgs); @@ -816,7 +816,7 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata) byt->dsp = sst_dsp_new(dev, &byt_dev, pdata); if (byt->dsp == NULL) { err = -ENODEV; - goto list_err; + goto err_free_msg; } /* keep the DSP in reset state for base FW loading */ @@ -848,9 +848,9 @@ boot_err: sst_fw_free(byt_sst_fw); fw_err: sst_dsp_free(byt->dsp); +err_free_msg: kfree(byt->msg); -list_err: - kfree(byt); + return err; } EXPORT_SYMBOL_GPL(sst_byt_dsp_init);