From: Bjorn Helgaas <helgaas@kernel.org>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: "Daire McNamara" <daire.mcnamara@microchip.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: microchip: Fix refcount leak in mc_pcie_init_irq_domains
Date: Wed, 8 Jun 2022 15:27:40 -0500 [thread overview]
Message-ID: <20220608202740.GA419783@bhelgaas> (raw)
In-Reply-To: <20220605055123.59127-1-linmq006@gmail.com>
On Sun, Jun 05, 2022 at 09:51:23AM +0400, Miaoqian Lin wrote:
> of_get_next_child() returns a node pointer with refcount incremented,
> we should use of_node_put() on it when not need anymore.
> This function only call of_node_put() in 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")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Applied with Rob's reviewed-by to pci/ctrl/microchip for v5.20,
thanks!
> ---
> 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.25.1
>
prev parent reply other threads:[~2022-06-08 20:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-05 5:51 [PATCH] PCI: microchip: Fix refcount leak in mc_pcie_init_irq_domains Miaoqian Lin
2022-06-06 21:32 ` Rob Herring
2022-06-08 20:27 ` Bjorn Helgaas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220608202740.GA419783@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=daire.mcnamara@microchip.com \
--cc=kw@linux.com \
--cc=linmq006@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).