Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9412945ybi; Wed, 10 Jul 2019 09:50:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHTGNdk0sMPx1TieZn9sfTNfgb764FkMA2uVvvicjqSa/yAoohA/3U4gy04g+tcjuZvxQV X-Received: by 2002:a17:90a:1b4a:: with SMTP id q68mr8020813pjq.61.1562777409839; Wed, 10 Jul 2019 09:50:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562777409; cv=none; d=google.com; s=arc-20160816; b=lOAZAY/TdrmNViTH9elboOEXlG3uRwU8V3RpKjG4orPtBSqQwxA7iK75OggdYjY6kB tH8kk9RjC1+9o0ZA2dUTwlLUka1q7jMqPVZkC+Uvm1irB9apN64kB9awt7iJXDBDRPmd lAr6UV27fU1rVdxByFubauXGFBR5o3E5NifabpuDOisSFHWv++28etEsdgtNMtiy6nx/ 1Rl9Tbn6cjkaL5bn10laIXpfGHCuQU24Hz7pV2UwvK3JD4y2dGc9Sbx8kCuNae/mLscJ y1BKV7V/gDcbjX8VTxRSNJcEMQFGHA5rNZGKSitqQO2E2MSTgnQ2HkmepXCz1qBFyehb Z5Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=OJOmdq13zo6Dlox6R8w0maL9PomW9D3dvtCqc3uExQc=; b=nQFh25X6DwxXRQT7FOb/zYrdxU8q1iXwJIC6MVJEqOJNkI0YGusXwXMzbQ0ZN9dlP1 G14gaZDWNdjBxrIcL9bcfhwMSQKFwVNo5es6xuQDsPSdN5rdPQwUj81VxTNTBpXHKbDe U8C50zPdQpnkxfr3uo5dHQmzkUjWFRK2KqqZERFKhyOBMXgHvouy+2Zi/TlNNTI+eKQU oWFpE802SfVK9QpDXwRfdkYNe4BQ1kJAt8nQWtKma7p8gI3foGzDewV1lMT8QQq0GepB 5Hc77nXJic6aZZ+pD7RZxGWU63ODXnnke5jmqUk22YNsEJzJbTL0vxTmYF+YFz60qb2K K0OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=Uv1gESDP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m16si2794227pgh.143.2019.07.10.09.49.53; Wed, 10 Jul 2019 09:50:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=Uv1gESDP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727682AbfGJPfQ (ORCPT + 99 others); Wed, 10 Jul 2019 11:35:16 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:45800 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727515AbfGJPe4 (ORCPT ); Wed, 10 Jul 2019 11:34:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=OJOmdq13zo6Dlox6R8w0maL9PomW9D3dvtCqc3uExQc=; b=Uv1gESDPPiCo lPtmbPmjX2y7Nie7E7zeXLbxWyxlbzrpfP4w0oixJ3/Zqlg2FvIFK8z6fGrvMBqFjZ0Z8+X0MmVno muBDH6DP8ngecW5Z1u8tR2AB8XQzu6nVOPXyibfEuYRa0JuncpO6LvvNfjnCeCFHpPlABQ0A42tud Raqcw=; Received: from [217.140.106.53] (helo=fitzroy.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hlEcG-00082w-Ir; Wed, 10 Jul 2019 15:34:44 +0000 Received: by fitzroy.sirena.org.uk (Postfix, from userid 1000) id 3A14AD02D7C; Wed, 10 Jul 2019 16:34:44 +0100 (BST) From: Mark Brown To: Wen Yang Cc: alsa-devel@alsa-project.org, broonie@kernel.org, cheng.shengyu@zte.com.cn, jonathanh@nvidia.com, kuninori.morimoto.gx@renesas.com, Kuninori Morimoto , lgirdwood@gmail.com, linux-kernel@vger.kernel.org, Mark Brown , tiwai@suse.com, wang.yi59@zte.com.cn, xue.zhihong@zte.com.cn Subject: Applied "ASoC: simple-card: fix an use-after-free in simple_for_each_link()" to the asoc tree In-Reply-To: <1562743509-30496-3-git-send-email-wen.yang99@zte.com.cn> X-Patchwork-Hint: ignore Message-Id: <20190710153444.3A14AD02D7C@fitzroy.sirena.org.uk> Date: Wed, 10 Jul 2019 16:34:44 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ASoC: simple-card: fix an use-after-free in simple_for_each_link() has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 27862d5a3325bc531ec15e3c607e44aa0fd57f6f Mon Sep 17 00:00:00 2001 From: Wen Yang Date: Wed, 10 Jul 2019 15:25:07 +0800 Subject: [PATCH] ASoC: simple-card: fix an use-after-free in simple_for_each_link() The codec variable is still being used after the of_node_put() call, which may result in use-after-free. Fixes: d947cdfd4be2 ("ASoC: simple-card: cleanup DAI link loop method - step1") Link: https://lore.kernel.org/r/1562743509-30496-3-git-send-email-wen.yang99@zte.com.cn Signed-off-by: Wen Yang Acked-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/generic/simple-card.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 4117e54884e5..ef849151ba56 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -364,8 +364,6 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, goto error; } - of_node_put(codec); - /* get convert-xxx property */ memset(&adata, 0, sizeof(adata)); for_each_child_of_node(node, np) @@ -387,11 +385,13 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, ret = func_noml(priv, np, codec, li, is_top); if (ret < 0) { + of_node_put(codec); of_node_put(np); goto error; } } + of_node_put(codec); node = of_get_next_child(top, node); } while (!is_top && node); -- 2.20.1