Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1865138rwb; Fri, 19 Aug 2022 10:40:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR5VJ16IJbtgDa9EsaRLSVY61f9NkhpTpykHj+jQbLaVUD3+JEH1v30DT1dZ4WGK+JGa+xPi X-Received: by 2002:a63:454:0:b0:422:3ee0:32fe with SMTP id 81-20020a630454000000b004223ee032femr7256933pge.97.1660930813357; Fri, 19 Aug 2022 10:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930813; cv=none; d=google.com; s=arc-20160816; b=E9D1UJQJUtAzJTd1+tabClR8i1SAqkVXfkZlFRXsmUAUYaeA++/Eiux9GPgwsHXH2Q 0VzMgFHKcX2Alh07XY4R6KUieiQYIDVatGKJngl66q1bLNBoGXZorzS+AT2M5IUaEya2 qyKKdghi1en5e6JdEtqo0KkmmkSoWqXxpROU63wBUaJDQXsvLcnHFftg6NG/C1n1K+XH nz3JDs3Y7j944GPIqGWCZtao7ibYYF6kfGhs4KmV4yiWlnIpMvwwVt5qdk4ah36a7Pyg EqB/TpnkUO0lrk03+Z6iknVch3W95Yy8W0A6ZTy59UDYmUGpoFFZpOt161pVorwunTiA FVPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/V5a7tcQznMHbp8cYaZk4js4EnFqHo0S0VRfIg9IGA8=; b=upAs8yqumIaxwRertUTWBOcN7Cr7z6cJOoWHEYo7SqvsL7g72ANNUfqaazD9xeLdcU id+bOorbVsU8V7LS5WCQHTvykikWDfZBPIRC6FZqa68cJ4YodmvVk5Ea6ZpIOYamcPqY JUyMaB74JPiLI6YHzTwzMEuv+0MvvSdTIYFHsVJtZ31JEiTY0+5l+t18PBj2mMfILKle b1V6xsTyo+H3kw9pP3QIpO6kt61mF/acPpGoOOYr5jll8wUxFrwR6rZr5owXJ+jXLkn7 imlvr8vlwaz1Asosv8NRd5tptZm300tJGvs8lMLRnwqlkSCw/oqZuRDTfiajKB1IMj1b o34Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QGgnb6WS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d17-20020a170903231100b00170c27c2b6asi2980900plh.114.2022.08.19.10.40.02; Fri, 19 Aug 2022 10:40:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QGgnb6WS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350324AbiHSQcf (ORCPT + 99 others); Fri, 19 Aug 2022 12:32:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352906AbiHSQ3G (ORCPT ); Fri, 19 Aug 2022 12:29:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0C0F119A6F; Fri, 19 Aug 2022 09:04:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 73474616B3; Fri, 19 Aug 2022 16:04:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 792FCC433D7; Fri, 19 Aug 2022 16:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660925056; bh=Fq2/Qa+l2s9n7XYaDXSNDg2FJSRH8B8oFrH9I8yNc8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QGgnb6WSjnyrq0PuKlsFfQAYi10ExUO8euX+rRw4G+mOvY4dtnDoES37ksGapsaBF Ou+wkzJQ0cdpTOY27QN2TrxYWSWV8awCQbD6RDHooCHuQxMAhQsi7NWGDyVOiDy/nW kdWq/VF+V+kl7W40gFuf7u7jrgbjD6z7wSvqSiOY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: [PATCH 5.10 369/545] ASoC: mediatek: mt8173-rt5650: Fix refcount leak in mt8173_rt5650_dev_probe Date: Fri, 19 Aug 2022 17:42:19 +0200 Message-Id: <20220819153845.923057269@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaoqian Lin [ Upstream commit efe2178d1a32492f99e7f1f2568eea5c88a85729 ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Fix refcount leak in some error paths. Fixes: 0f83f9296d5c ("ASoC: mediatek: Add machine driver for ALC5650 codec") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220603124243.31358-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek/mt8173/mt8173-rt5650.c index e168d31f4445..1de9dab218c6 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -280,7 +280,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) if (!mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret = -EINVAL; + goto put_platform_node; } mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node = mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node; @@ -293,7 +294,7 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s codec_capture_dai name fail %d\n", __func__, ret); - return ret; + goto put_platform_node; } mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[1].dai_name = codec_capture_dai; @@ -315,7 +316,8 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) if (!mt8173_rt5650_dais[DAI_LINK_HDMI_I2S].codecs->of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret = -EINVAL; + goto put_platform_node; } card->dev = &pdev->dev; @@ -324,6 +326,7 @@ static int mt8173_rt5650_dev_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); +put_platform_node: of_node_put(platform_node); return ret; } -- 2.35.1