Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3256716rwb; Mon, 15 Aug 2022 22:29:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR4o101rwMcgdxPTuOu77aLOJmXp4CrX2k4CweZgo8ZV4MfeoLxCzsqm86mfURdVfwJ5/est X-Received: by 2002:a05:6402:5249:b0:43c:cb3e:d7f8 with SMTP id t9-20020a056402524900b0043ccb3ed7f8mr17558207edd.56.1660627744043; Mon, 15 Aug 2022 22:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660627744; cv=none; d=google.com; s=arc-20160816; b=AwSrzD5hhUQKYDZNXAQFqgpiAyUOiL/np8gPx9ZHcaLe4uT7hQx6eroqv4x5YtPFS0 rwBM4395dJkL+myFAnlyiBlrKjaYPnb8UYwX5IAIBFnyqRqoeSPoldoZiTcJGogjCAVe lrLH22RkIDIDY7WEA1klOtzJ9XAw48/9Fq1QZu/sBwE1b/e8Up8ODJw1AEdyjCFR454j HynaAifUy/AK8HHDyuTuGYn0aS9yOpXNiV5AgyoZ/Yzac44jV+Lo0c0BcEj8yfKqdMNd pRGPsrw7vwy7fYn8HmoqbgjyozpcVuP5KWqGXzurtUOAyUCmK7sF/9RPw4nwmthmMlHe OscA== 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=+zJy2hHo4OY/y+ZjbC8k540L4CBMITWMiCIPdvpJClg=; b=xIHPDYgKr97NCmkRZqiTqTH2gUsGtET3a4rdpwlTJ7IE9nqVjJP5NUbAuCxZlsB/K9 QZaKnco0DIHABz04QZ/Grh4RHyEOp0HPV9yaiHE2lPd1e17pMCM31DZFg0+EXS7qUsWP Rdj5Ve67HSjP9pPjWafgeExV/Pom1OKW6Q6s5SC3YgxdOAe3tXLtvWsVzIwmE+uvZ/c/ qzlOxnylmUOd5M6BdGh3pIIVMCoyXW6OBmeETDJ9QS+tzN7CqreKa0/PNu5kKELx3n3w Mtw81OGPQx6K6mY1kYy2bSFZ13DviU2r2kK/X2dNLuT/gKmDzNKudv8WVJokpr6V0sOk xF3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MKLiw1Lr; 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 r2-20020a056402034200b0043e64d81518si8707996edw.619.2022.08.15.22.28.38; Mon, 15 Aug 2022 22:29:04 -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=MKLiw1Lr; 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 S230166AbiHPEck (ORCPT + 99 others); Tue, 16 Aug 2022 00:32:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229825AbiHPEcI (ORCPT ); Tue, 16 Aug 2022 00:32:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3BCE193F2; Mon, 15 Aug 2022 13:22:17 -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 80FF460F60; Mon, 15 Aug 2022 20:22:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70056C433C1; Mon, 15 Aug 2022 20:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594936; bh=UA4CGN5pQUGKiJSR+n6oMVNpzJodTwCIgeiovrvABLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MKLiw1Lrqd113MZEAZF1FQunQTlybZoIAp8w7Ses00UudJdc7YW1bR6dFCP0uB8zN EJyOIpnLd6zmQoWitrfSZQMvGQLsxGosP5yFOJZzJAVqpgxqXCJHm0DrvlxTdnxCf6 BRt/HdCUYruY2ABu65XTdJwUyBXrVrmPoBASGg7U= 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.19 0605/1157] PCI: mediatek-gen3: Fix refcount leak in mtk_pcie_init_irq_domains() Date: Mon, 15 Aug 2022 19:59:21 +0200 Message-Id: <20220815180503.877537980@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c index 5d9fd36b02d1..a02c466a597c 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_gen3_pcie *pcie) &intx_domain_ops, pcie); if (!pcie->intx_domain) { dev_err(dev, "failed to create INTx IRQ domain\n"); - return -ENODEV; + ret = -ENODEV; + goto out_put_node; } /* Setup MSI */ @@ -623,13 +624,15 @@ static int mtk_pcie_init_irq_domains(struct mtk_gen3_pcie *pcie) goto err_msi_domain; } + of_node_put(intc_node); return 0; err_msi_domain: irq_domain_remove(pcie->msi_bottom_domain); err_msi_bottom_domain: irq_domain_remove(pcie->intx_domain); - +out_put_node: + of_node_put(intc_node); return ret; } -- 2.35.1