Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3017358rwb; Mon, 15 Aug 2022 16:13:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR76gc+3JKstOaG3cefyIW9K2bLrkoo629pv5Wyfi0R62dwah4mMGpu6Ee/Mngg+A9O+qD0x X-Received: by 2002:a17:907:28d6:b0:731:5d0:4401 with SMTP id en22-20020a17090728d600b0073105d04401mr11676189ejc.765.1660605239486; Mon, 15 Aug 2022 16:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605239; cv=none; d=google.com; s=arc-20160816; b=kxvy6U6ViMrzK7UZ4QCNHWHfni6x98xyLzICuy/vVPr8+ggxlQUzecpHF08Rcilcwm tiwN9jJJW2Cz6z11yHI8rkPRVZzvZf7fo6wKamBwWpuXmMS2rJXgt7Q1sKlLpzx6Q10+ iXxc17my8P+t21Dr6slkf0RiazZUlzgeeWNmABPWadkQQd8ucTOSI2bhwCA9AopqY83m hwV4QEZZDG4bWqW9cpiYnMkU0ZQO5U4FBz3AK6/P7DLNVx7wOg4Rgzlr1etS/Mg+8wDA awq0utA7XU5CcUrYqUD2AAtmM4FhCtRnufl5ll1IpAXyxU7wkiFiBMTz909iOWu2llUD hMsA== 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=yabyA1M15yO/nqsc2wtmxMedy0J045baLjvhpee2nyU=; b=Q3YuQRKwx/Hg/0kO0UrX51fqw01XTGGjO578zvQly2LCQslzSTjeq16bqRcl5QgYJE YL6CRNCG8Wx5coGoE17DsUk9KHWrI4gVTlNkXY6KQYa/GcsBDixl9Sr9EsYGx2RvY7ZV 3H7a/Hd5KFRoFrGMlf73LPkgobbGTyHkQ7eeU5OtArZSu+KbQrDqqzjGaAYlLFHy2HPY GauQJwNrnCyYoReQzMWE/37pSf3Q5rrwgFEcPDduzDp2juPK/XSWNcTrZVyqSAiiUQgc ZhSp2aSwRXN5CMGjcx6GC85qVK0xE5CuYOlhZ4R/LVNOFWg8pqx1rW0ElkJ8UvD6sU81 55jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JELQf5TG; 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 ds3-20020a170907724300b00730fdb36019si10035165ejc.21.2022.08.15.16.13.33; Mon, 15 Aug 2022 16:13:59 -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=JELQf5TG; 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 S1348231AbiHOVa2 (ORCPT + 99 others); Mon, 15 Aug 2022 17:30:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348224AbiHOV1E (ORCPT ); Mon, 15 Aug 2022 17:27:04 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BAF9E97D0; Mon, 15 Aug 2022 12:23:01 -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 sin.source.kernel.org (Postfix) with ESMTPS id 5E47BCE12C4; Mon, 15 Aug 2022 19:22:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F708C433D7; Mon, 15 Aug 2022 19:22:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591377; bh=Pb+Su699391mtr7066eQ49nAxJ3tqsKaKrMulCNhQ/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JELQf5TGpBbND2dUNmYbsDsJU+kmcWoMEF/yN5sWefxRCawBCBabnd4kNJysEbBB4 axo+sxKhXPfpEqbZ3fzOm+p3G1rbTuubsR4AmszO9NpKjTviAqKVdSy2FpaX5vrw+L H91NxnpsVEjnaIqaKSTJWW+TRQJ50RYIxb756O7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.18 0560/1095] PCI: microchip: Fix refcount leak in mc_pcie_init_irq_domains() Date: Mon, 15 Aug 2022 19:59:19 +0200 Message-Id: <20220815180452.738930098@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 f030304fdeb87ec8f1b518c73703214aec6cc24a ] of_get_next_child() returns a node pointer with refcount incremented, so we should use of_node_put() on it when we don't need it anymore. mc_pcie_init_irq_domains() only calls of_node_put() in the normal path, missing it in some error paths. Add missing of_node_put() to avoid refcount leak. Fixes: 6f15a9c9f941 ("PCI: microchip: Add Microchip PolarFire PCIe controller driver") Link: https://lore.kernel.org/r/20220605055123.59127-1-linmq006@gmail.com Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Helgaas Reviewed-by: Rob Herring Signed-off-by: Sasha Levin --- drivers/pci/controller/pcie-microchip-host.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/controller/pcie-microchip-host.c index 2c52a8cef726..932b1c182149 100644 --- a/drivers/pci/controller/pcie-microchip-host.c +++ b/drivers/pci/controller/pcie-microchip-host.c @@ -904,6 +904,7 @@ static int mc_pcie_init_irq_domains(struct mc_pcie *port) &event_domain_ops, port); if (!port->event_domain) { dev_err(dev, "failed to get event domain\n"); + of_node_put(pcie_intc_node); return -ENOMEM; } @@ -913,6 +914,7 @@ static int mc_pcie_init_irq_domains(struct mc_pcie *port) &intx_domain_ops, port); if (!port->intx_domain) { dev_err(dev, "failed to get an INTx IRQ domain\n"); + of_node_put(pcie_intc_node); return -ENOMEM; } -- 2.35.1