All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wentao Liang" <vulab@iscas.ac.cn>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: xgene: Fix device node reference leak in xgene_pcie_probe()
Date: Thu, 17 Sep 2026 13:29:42 +0000	[thread overview]
Message-ID: <20260917132943.2EF5D1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260917132235.2153154-1-vulab@iscas.ac.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] pci: xgene: refcount underflow and build failure due to hallucinated of_node_get()
--

commit 3a601f05188e398e03ea9af2fc4238c97e5b4cf2
Author: Wentao Liang <vulab@iscas.ac.cn>

PCI: xgene: Fix device node reference leak in xgene_pcie_probe()

This patch attempts to fix a device node reference leak in the error paths
of xgene_pcie_probe() by adding an error handling label that drops the node
reference.

Cc: stable@vger.kernel.org

> diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c
> index 83c9a2930eeca..6b922120db3fc 100644
> --- a/drivers/pci/controller/pci-xgene.c
> +++ b/drivers/pci/controller/pci-xgene.c
[ ... ]
> @@ -630,20 +630,28 @@ static int xgene_pcie_probe(struct platform_device *pdev)
[ ... ]
> -	return pci_host_probe(bridge);
> +	ret = pci_host_probe(bridge);
> +	if (ret)
> +		goto err_put_node;
> +
> +	return 0;
> +
> +err_put_node:
> +	of_node_put(port->node);

[Severity: High]
Does this patch introduce a refcount underflow and a build failure?

The commit message states that xgene_pcie_probe() takes a reference with
of_node_get(), but that function does not appear to be called anywhere within
xgene_pcie_probe(). If there is no prior of_node_get() incrementing the count,
calling of_node_put() on these error paths will drop an unowned reference,
potentially causing a use-after-free of the device node.

Additionally, does struct xgene_pcie contain a node member? It appears this
struct does not have a node field, which means accessing port->node will
cause a build failure.

> +	return ret;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260917132235.2153154-1-vulab@iscas.ac.cn?part=1

  reply	other threads:[~2026-09-17 13:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 13:22 [PATCH] PCI: xgene: Fix device node reference leak in xgene_pcie_probe() Wentao Liang
2026-09-17 13:29 ` sashiko-bot [this message]
2026-09-18 11:50 ` kernel test robot
2026-09-18 12:37 ` kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-08-14 13:41 Ruoyu Wang
2026-08-14 13:51 ` sashiko-bot
2026-09-10 12:23 ` Manivannan Sadhasivam

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=20260917132943.2EF5D1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vulab@iscas.ac.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.