From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
To: Vishal Satle <vishalsatleit24@gmail.com>
Cc: "Hou Zhiqiang" <Zhiqiang.Hou@nxp.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Rob Herring" <robh@kernel.org>,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] PCI: mobiveil: Fix device_node leak in ls_g4_pcie_probe()
Date: Thu, 05 Nov 2026 19:44:57 +0530 [thread overview]
Message-ID: <179388809743.2730.8434004843297816557.b4-reply@b4> (raw)
In-Reply-To: <20261027094427.143733-1-vishalsatleit24@gmail.com>
On 2026-10-27 15:14 +0530, Vishal Satle wrote:
> ls_g4_pcie_probe() calls of_parse_phandle() to verify the presence of
> the "msi-parent" device node. of_parse_phandle() increments the reference
> count of the returned device_node.
>
> Because the return value was evaluated directly as a boolean condition,
> the acquired reference was never released, leaking the MSI controller node
> reference count on probe.
>
> Assign the resolved node to a local variable and call of_node_put() once
> the existence check is complete.
>
> Cc: stable@vger.kernel.org
>
Why? This is not a critical bug fix to backport.
> Signed-off-by: Vishal Satle <vishalsatleit24@gmail.com>
> ---
> drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c b/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
> index 4919b27ea..5b1862fe0 100644
> --- a/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
> +++ b/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
> @@ -199,12 +199,15 @@ static int __init ls_g4_pcie_probe(struct platform_device *pdev)
> struct mobiveil_pcie *mv_pci;
> struct ls_g4_pcie *pcie;
> struct device_node *np = dev->of_node;
> + struct device_node *msi_node;
> int ret;
>
> - if (!of_parse_phandle(np, "msi-parent", 0)) {
> + msi_node = of_parse_phandle(np, "msi-parent", 0);
> + if (!msi_node) {
You should just use of_property_present() and be done with it. The driver is not
using the phandle and it shouldn't care if it resolves to a proper node or not
as it will be verified by the irqchip layer.
But that being said, I really doubt whether we need this check or not. None of
the other controller drivers are having this check. If this property is absent,
then MSIs won't work, but INTx will continue to work. So the controller wouldn't
be broken altogether.
So this check can be dropped.
- Mani
next prev parent reply other threads:[~2026-11-05 14:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 9:44 Vishal Satle
2026-11-05 14:14 ` Manivannan Sadhasivam [this message]
2026-11-18 9:37 ` [PATCH v2] PCI: mobiveil: Drop unnecessary msi-parent check " Vishal Satle
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=179388809743.2730.8434004843297816557.b4-reply@b4 \
--to=manivannan.sadhasivam@oss.qualcomm.com \
--cc=Zhiqiang.Hou@nxp.com \
--cc=bhelgaas@google.com \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=stable@vger.kernel.org \
--cc=vishalsatleit24@gmail.com \
/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
all inboxes | Powered by JetHome®