Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3061041rwb; Mon, 15 Aug 2022 17:09:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR7/uAE58kgMKdHGMsu/Tc8lgVJqYQsoEPGTm5XXMUzDI6Q8YqI2F85qnxzv1pDRjkUhFggo X-Received: by 2002:a05:6402:530e:b0:443:df38:9df with SMTP id eo14-20020a056402530e00b00443df3809dfmr4201146edb.9.1660608595958; Mon, 15 Aug 2022 17:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660608595; cv=none; d=google.com; s=arc-20160816; b=zsaWkjU7K7UHsD6EMrCKe24uSDQMCcc3TGb49el0XfWv3+mbaLXurDP3QEpN8OelYP e8n9kGQwpEETP5BftcIGP+Zm5ZGCohorSHNzrUVQsrqLlIniqh8b2JiwFI6EB5nXNn7p egdS2IyC0oHPR7UlUVDxP6htI1HHgYgTmYp9F7yMe3v7k4sXKMAys2ESMPHW++fPBrRo U3v8ftcgO0XhRBTJjlSObqyMZDoYL0SUf6Uo5H44b3uJNHGq0rRN9qHOt6Boj0sD1Jrz 8k4Dk+dMsjU5g/XO9MUcwBu6oVTqrQI5CHJj25MulBskpIlw8MRGqVal8fibIB2aPMFv xu9A== 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=limR8Cio9VeJlx0sTs/GZMBgOvNjcmKrxzaGTCWxOz0=; b=CMpsCQTrxNi0mRJXOJwEbXje2oZ12GAYaRq1wKz4YFjJQIWnA51avhk55/v+ys2X2z Cwz+JIgG6+5ZksAr0ueksDf3OH7Tui8aV9susNh/yySi4QI9ocGcLBWw5sJI5Vh/JSkw KT9B0fUnBiEbsRs4W9lEKoYigPCFh9eDhfT9CvwSzYfS/9OfFRLqRPjsWba3JgqKGZc7 g6dZOGxg0dnEcPLq9s2O3AHHu4Gu/mnAiOfTqHUVGEOZn3xbilGQa8ic0li5YvMeQSq2 ETgJXMT9KxO507LIomFw/LFAUu39pQmX8KxElVktdu8D4+b3C4sxudkIh/O2ohAcs/y6 HTQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qxNeUjdZ; 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 s23-20020aa7d797000000b0043d2ff128cfsi9112788edq.286.2022.08.15.17.09.23; Mon, 15 Aug 2022 17:09:55 -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=qxNeUjdZ; 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 S242884AbiHPAIF (ORCPT + 99 others); Mon, 15 Aug 2022 20:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351740AbiHPAAZ (ORCPT ); Mon, 15 Aug 2022 20:00:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33F3233407; Mon, 15 Aug 2022 13:21:37 -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 C233F61058; Mon, 15 Aug 2022 20:21:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD4DAC433C1; Mon, 15 Aug 2022 20:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594896; bh=dKGeSzlcGwjg9tzsVcq5EvTIrGoJIeRYHb0rFcWwg9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qxNeUjdZ6giBid6LvZfuIgT18m7zbFsz+pp0T2PWzVyOkIfpTpCVuN4TZYl2EnmH1 juDXO3hSJpHM48qFmjNzLEIQwpZJFzZ87jJWfy0gN2mDZb+EP4Orh3BQHhZrbgYy3+ eJhhXpH17dUiGqMZDtUH/bBZrclv8YxvAyPE44B4= 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.19 0594/1157] PCI: microchip: Fix refcount leak in mc_pcie_init_irq_domains() Date: Mon, 15 Aug 2022 19:59:10 +0200 Message-Id: <20220815180503.417993662@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 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 dd5dba419047..7263d175b5ad 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