Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2921146rwb; Mon, 15 Aug 2022 14:05:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR67feSK2sNp7CEPfK9FFTHGi3YcuG1w2zC9lcwe+1qyjyMq0WhVIrKIVWt2xZZeUff9Bf9p X-Received: by 2002:a17:907:7623:b0:730:c378:b82e with SMTP id jy3-20020a170907762300b00730c378b82emr11181199ejc.372.1660597532466; Mon, 15 Aug 2022 14:05:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597532; cv=none; d=google.com; s=arc-20160816; b=qP4Rg036guRvjYuNYme/uUim3DBSAVIzba7JwrNmkIfFHtr8r+DSxoH28+FIFbV0B0 EAlZtsmX6EfH/01IkfZEL4B34xZE+SZZ9eSdJU887Y++v1B2qeBz+jXZ1pXtnwH4oFiz I4vHqOXbhbm92hh3+EWeqtehoAXVz6GpruMG9ltvn75qJdRbrbFzDavCKkzpZoFj0fTM n+UaS4uBjO8NRnl4vREpGTheLvMC0O9BmVGwiE3II9uW30KKi+Rx3JVuLmxFdfZCsd9R it1BnbDEYynzNwxBh6Kuo9uty9+oMCftDPQErulhB4v0I0CU4/jbmyJ9eVahdinRVzZw pn/g== 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=G0nIQQCLI/uboK1Vd7Hy4PLjHeguEvsqKdfnTi5nKsA=; b=ayOb3Ecz6b+bVPzpsU7SkdYramMnk4lIWDZvgs/RGcuLqk+3mLl5z1zi6Zt2iKBVki DZ1erVQut14+B4e/NNQnIc/DtuqF7NR08TYaFuUfMwCRH4i2s2ulfz7ptVeMjJBJS7+k GjsPk6agOxHrPJCzPyRm0ry2pvkYagdsXdOg12aSdfZMeadmNKTR/JCbEK3bWzJguDM+ 6jWY2K3vMzs65ypohmUErfyWZObWfJWTvfot94MTakN0PCUgOQOzJO5fD92ePrs2F2iQ BbvIY3482QknvCH9eBs7nIA6ZfGbOZlzdZouZbZHrI5VBPglYCDuV9oUQ2aRRl65/NA+ fezw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PYt+gip9; 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 v21-20020a056402349500b0043e7a56ad4fsi9198198edc.69.2022.08.15.14.05.06; Mon, 15 Aug 2022 14:05:32 -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=PYt+gip9; 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 S1343686AbiHOTKD (ORCPT + 99 others); Mon, 15 Aug 2022 15:10:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245530AbiHOTFs (ORCPT ); Mon, 15 Aug 2022 15:05:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9666237197; Mon, 15 Aug 2022 11:34:29 -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 ams.source.kernel.org (Postfix) with ESMTPS id 3AFA3B81081; Mon, 15 Aug 2022 18:34:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83AA8C433D7; Mon, 15 Aug 2022 18:34:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588466; bh=nU4IgZFphg6AoJaV+SrFVf3iKL/JaX8zy6tYKTj6tXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PYt+gip9PTveLGstnxXginz+3wLmAnKFEO6vH6uUMZBuaYqgE5Q8MRUqVc4Kd+WEl FOmsatQ4hmHIrYOJQqoa2Ge67hGSM8iGqoSCkuAMTRpTLXfFFDv/QJc/SBndMg3q3S QPOGkmrJBxMZQiyzeVJpgl/ipY3LYTfwWcET4G6g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Helgaas , Miles Chen , Jianjun Wang , Sasha Levin Subject: [PATCH 5.15 412/779] PCI: mediatek-gen3: Fix refcount leak in mtk_pcie_init_irq_domains() Date: Mon, 15 Aug 2022 20:00:56 +0200 Message-Id: <20220815180354.881759498@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 bf038503d5fe90189743124233fe7aeb0984e961 ] of_get_child_by_name() returns a node pointer with refcount incremented, so we should use of_node_put() on it when we don't need it anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 814cceebba9b ("PCI: mediatek-gen3: Add INTx support") Link: https://lore.kernel.org/r/20220601041259.56185-1-linmq006@gmail.com Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Helgaas Reviewed-by: Miles Chen Acked-by: Jianjun Wang Signed-off-by: Sasha Levin --- drivers/pci/controller/pcie-mediatek-gen3.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c index 21207df680cc..36c8702439e9 100644 --- a/drivers/pci/controller/pcie-mediatek-gen3.c +++ b/drivers/pci/controller/pcie-mediatek-gen3.c @@ -600,7 +600,8 @@ static int mtk_pcie_init_irq_domains(struct mtk_pcie_port *port) &intx_domain_ops, port); if (!port->intx_domain) { dev_err(dev, "failed to create INTx IRQ domain\n"); - return -ENODEV; + ret = -ENODEV; + goto out_put_node; } /* Setup MSI */ @@ -623,6 +624,7 @@ static int mtk_pcie_init_irq_domains(struct mtk_pcie_port *port) goto err_msi_domain; } + of_node_put(intc_node); return 0; err_msi_domain: @@ -630,6 +632,8 @@ static int mtk_pcie_init_irq_domains(struct mtk_pcie_port *port) err_msi_bottom_domain: irq_domain_remove(port->intx_domain); +out_put_node: + of_node_put(intc_node); return ret; } -- 2.35.1