Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2924054rwb; Mon, 15 Aug 2022 14:08:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR7zNh1Wq6laScHvWcEKYYU5ut0XBob98WBjrNLphVBGv62+y7ebaF5nSWuz8F3Cbk9Bg5SK X-Received: by 2002:a17:907:10d1:b0:730:7c7d:3869 with SMTP id rv17-20020a17090710d100b007307c7d3869mr11086584ejb.356.1660597739638; Mon, 15 Aug 2022 14:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597739; cv=none; d=google.com; s=arc-20160816; b=H+IDFepPne6xvP+2p7aYnK+ML2hoILqg8SGk35Ee81fcLHtaPW0wYNq+BmsD8idZiq z/6chwsQUnfizxPpbHj2zvjT8YNCW3AlCkbueXSqJatQofOKxTxo0jWWRJa4tvlLgjVq G/Md3RR1RrLMZ4z79lsXYvpFGaIOrmXLpNhUu1PZ5+/BApC5t5fhn9Uo9ixu0ex5x4GH 8YnjM51OfUVSqeFbDwwA6GDe3X5GQFM7qWgYjcDRzBxzEuKn9ELUzPftae/fypgqtks8 g0bHYDqjaqiru9NuyYqQuwsgd5meaXaF61bfYWpnQlgeDbWQ9rWQ+ljOnvH81oj109C7 nAFg== 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=FFfasohp+NIGqZcVI353PUOLMHYjrFGbNDX3weJZl24=; b=yXbkpSr8T6PaZLjRv/Y0sv1BAhFe39Q7knb8aXGWrKnT85+rfQzmO0I5c7R2WLVIzc nFgFjo+KnTi95d1uquZMehHknbhagHXxfEK1Cp9/YpC/RRbBlCkEJUM82mPqDd+kDjoq sNjvddi2wsqKgur/OoExhNLjxjbfBmxh95opML3Y+TJnz1A2mbp2L5zlF/+wizeiaGDv C4x5s5tOBtsLDYuKkE309R3b1eprFPBjfM26kDRO2EGROiZGrd1CBYxkELHhnp7VtBxj +GiDY2KgO4kRLtCH9rZUKXuxk7zGwYkRMEHp2fwkRtHeqICrH8Nn2fg/8Xguf3xj3MaD 6g3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aqmY4rY2; 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 b18-20020a056402351200b0043d9832325fsi8917991edd.541.2022.08.15.14.08.34; Mon, 15 Aug 2022 14:08: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=aqmY4rY2; 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 S245679AbiHOTH6 (ORCPT + 99 others); Mon, 15 Aug 2022 15:07:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245106AbiHOTD1 (ORCPT ); Mon, 15 Aug 2022 15:03:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2531E2C676; Mon, 15 Aug 2022 11:34:03 -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 8C5AD610A1; Mon, 15 Aug 2022 18:34:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74EB2C433C1; Mon, 15 Aug 2022 18:34:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588441; bh=PlyDoyIsXaRnZKrDQ6XhQ9WgrMtaT+erM0DDzUfZZb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aqmY4rY2r7UfBZY3BG1c6fBv2nBdyZy7VXH+MJ9b5riOH8uqhWX013a+vWlQj+O/9 fccfQUo2M1szyExAEAqxXbNGpchI4p+QxZkXMn/6HJxu+ws5301JGDoD/6Cfp9Dad6 shZSXt8epfhwP9lHnxtkTOsYmKOlOjXLrQbQZuSE= 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.15 405/779] PCI: microchip: Fix refcount leak in mc_pcie_init_irq_domains() Date: Mon, 15 Aug 2022 20:00:49 +0200 Message-Id: <20220815180354.593267517@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 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 fa209ad067bf..6e8a6540b377 100644 --- a/drivers/pci/controller/pcie-microchip-host.c +++ b/drivers/pci/controller/pcie-microchip-host.c @@ -894,6 +894,7 @@ static int mc_pcie_init_irq_domains(struct mc_port *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; } @@ -903,6 +904,7 @@ static int mc_pcie_init_irq_domains(struct mc_port *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