mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vishal Satle <vishalsatleit24@gmail.com>
To: "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>
Cc: 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,
	Vishal Satle <vishalsatleit24@gmail.com>
Subject: [PATCH] PCI: mobiveil: Fix device_node leak in ls_g4_pcie_probe()
Date: Tue, 27 Oct 2026 15:14:27 +0530	[thread overview]
Message-ID: <20261027094427.143733-1-vishalsatleit24@gmail.com> (raw)

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

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) {
 		dev_err(dev, "Failed to find msi-parent\n");
 		return -EINVAL;
 	}
+	of_node_put(msi_node);
 
 	bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
 	if (!bridge)
-- 
2.53.0


                 reply	other threads:[~2026-10-27  9:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261027094427.143733-1-vishalsatleit24@gmail.com \
    --to=vishalsatleit24@gmail.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 \
    /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®