From patchwork Tue Oct 7 11:41:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 5045191 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 39C0E9F295 for ; Tue, 7 Oct 2014 11:42:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B69EE201FE for ; Tue, 7 Oct 2014 11:42:15 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id CC4CB201F7 for ; Tue, 7 Oct 2014 11:42:14 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id AED532604F2; Tue, 7 Oct 2014 13:42:13 +0200 (CEST) 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 1D2D7260484; Tue, 7 Oct 2014 13:41:41 +0200 (CEST) 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 E3216260473; Tue, 7 Oct 2014 13:41:39 +0200 (CEST) Received: from mail.zonque.de (svenfoo.org [82.94.215.22]) by alsa0.perex.cz (Postfix) with ESMTP id DA669260452 for ; Tue, 7 Oct 2014 13:41:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.zonque.de (Postfix) with ESMTP id 4D9B4C588C; Tue, 7 Oct 2014 13:41:30 +0200 (CEST) Received: from mail.zonque.de ([127.0.0.1]) by localhost (rambrand.bugwerft.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lwOstyTup6Xl; Tue, 7 Oct 2014 13:41:30 +0200 (CEST) Received: from tamtam.fritz.box (p54AF41BA.dip0.t-ipconnect.de [84.175.65.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.zonque.de (Postfix) with ESMTPSA id DB38BC50F1; Tue, 7 Oct 2014 13:41:29 +0200 (CEST) From: Daniel Mack To: alsa-devel@alsa-project.org Date: Tue, 7 Oct 2014 13:41:23 +0200 Message-Id: <1412682085-5217-2-git-send-email-daniel@zonque.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1412682085-5217-1-git-send-email-daniel@zonque.org> References: <1412682085-5217-1-git-send-email-daniel@zonque.org> Cc: broonie@kernel.org, Daniel Mack Subject: [alsa-devel] [PATCH 1/3] ASoC: core: fix use after free in snd_soc_remove_platform() 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Coverity spotted an use-after-free condition in snd_soc_remove_platform(). Fix this by moving snd_soc_component_cleanup() after the debug print statement which uses the component's string. Signed-off-by: Daniel Mack --- sound/soc/soc-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 3d8cff6..4c8f8a2 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -4192,10 +4192,10 @@ void snd_soc_remove_platform(struct snd_soc_platform *platform) snd_soc_component_del_unlocked(&platform->component); mutex_unlock(&client_mutex); - snd_soc_component_cleanup(&platform->component); - dev_dbg(platform->dev, "ASoC: Unregistered platform '%s'\n", platform->component.name); + + snd_soc_component_cleanup(&platform->component); } EXPORT_SYMBOL_GPL(snd_soc_remove_platform);