Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3090581rwb; Mon, 15 Aug 2022 17:53:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Gqxe9M7EcOfIlxdMr6uvj+tspVTAdoyamz5Uh1H6MQdbrFKK5knDehUGpl3LxAsYr+7kn X-Received: by 2002:a17:907:75c1:b0:730:aa62:7f65 with SMTP id jl1-20020a17090775c100b00730aa627f65mr11549029ejc.355.1660611228237; Mon, 15 Aug 2022 17:53:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611228; cv=none; d=google.com; s=arc-20160816; b=h6xgdDyWJPukeKQn6zK85g5DTp0b7FTDz5toh34EjBnhhbnlR58fxj3D8ZmhLAaAop SoPuJiHxK2nyvq5T/+Op/DuBGZnu4Hwr5UaJQDBSDtedu1J7Ur6NRNAPyL6qR/Bw0qk0 KeDBi8NA56g45tANbLkw1KvHfdhPsqirpXlD8Uiso27aj/dLj4DBjAlAcFYfqRbqaGmr bkFatMA9wINxNW/F8u9qNTb/3kDHmsePy/hHQbtdnuaBWbxuTBvnKJ/fzfClwpxJciz9 vJIL3T5eqIt+j5MV5+U6DVMTlPyP51M17K8yMHkX/AOH+Mhfoe4rcp8QAlmJkr4Ep04A U3OQ== 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=U/W0WjZqYmeqWLTWdaXkWMW76hHj7to+wlgY2wsBKIupUZMv5BW2vC4H1QZIpbOUmV oCokdHpXSjIMseCBc+Lcx+q1bLm3+D+hyPJ2x9DVA3FtI+Xub9U0bhw2xaEJvEXX4nZU 6y+WMUnup19m/c8kF4tdLYIZ2+mwpyTp/ygYgHqs/qooVHGr3TR9i105YKLN6yYKSUHJ 31BV7EyTlLZ1TGnqTTKfKrN5fp6TVS1uE91XVlreAJMlYPe9RtPpS55JaTQpEJ+SSq3w Desd3WMOuYxMfYC9IaICxJ8WOO1ZSiQGZkhLugi42Xk8jOkCvAYUTyGgsagxhWgMbFni ILgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=InHLUGGu; 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 cy6-20020a0564021c8600b0043d4f544304si8157784edb.342.2022.08.15.17.53.23; Mon, 15 Aug 2022 17:53:48 -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=InHLUGGu; 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 S1348380AbiHOVbB (ORCPT + 99 others); Mon, 15 Aug 2022 17:31:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348439AbiHOV1k (ORCPT ); Mon, 15 Aug 2022 17:27:40 -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 38709EA8AA; Mon, 15 Aug 2022 12:23: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 C0FC060FBE; Mon, 15 Aug 2022 19:23:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B90B1C433C1; Mon, 15 Aug 2022 19:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591402; bh=UA4CGN5pQUGKiJSR+n6oMVNpzJodTwCIgeiovrvABLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=InHLUGGuCBic7HKAYQkqdiaYcotMgw9+Be8unnPR5XWdq6pgpl6bmGLq6wAuYX7fx jPgTKQh2mjcs4jIB0Rfc05ijRM8ywC6+iLpsEqJtgQkKcBdF6eDsMd7WgB3fPvIiJY NA/yz+ynCRX8wGEnkQcNSQs23ZWvV2YJVtkP/CMo= 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.18 0567/1095] PCI: mediatek-gen3: Fix refcount leak in mtk_pcie_init_irq_domains() Date: Mon, 15 Aug 2022 19:59:26 +0200 Message-Id: <20220815180453.036262195@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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