From: sashiko-bot@kernel.org
To: "Braden Zhang" <braden_zhang@lecomputing.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v4 v4] PCI: dwc: Add PCI ID for LECARC PCIe pmu
Date: Tue, 21 Jul 2026 06:49:32 +0000 [thread overview]
Message-ID: <20260721064933.632281F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260721-pcie-pmu-v4-1-850a4e695b19@lecomputing.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Low] The commit message claims that spaces were replaced with a tab, but the patch actually uses spaces.
Pre-existing issues:
- [High] The `dwc_pcie_pmu` driver caches a pointer to the PCI device (`pdev`) in `pcie_pmu->pdev` but explicitly drops the reference count. If the PCI device is removed, this leads to a Use-After-Free when the PMU driver accesses `pdev`.
--
--- Patch [1]: [PATCH v4 v4] PCI: dwc: Add PCI ID for LECARC PCIe pmu ---
commit c7438edb93a79853b55beed10ead3c56dfcc3ff6
Author: Brett Zhou <brett_zhou@lecomputing.com>
PCI: dwc: Add PCI ID for LECARC PCIe pmu
This patch adds support for the PCIe PMU found on LECARC SoCs by adding
the PCI vendor ID to the vendor-specific capability list. This enables
the standard DWC RAS/DES feature detection.
Link to v3: https://patch.msgid.link/20260713-pcie-pmu-v3-1-5e4a8d82248d@lecomputing.com
> Changes in v2:
> - Format: repalce space with tab to separate the macro name and the value.
[Severity: Low]
This isn't a bug, but there is a typo (repalce) in the changelog text.
[ ... ]
> diff --git a/include/linux/pcie-dwc.h b/include/linux/pcie-dwc.h
> index 8ff778e7aec0e..0df5fa81b5610 100644
> --- a/include/linux/pcie-dwc.h
> +++ b/include/linux/pcie-dwc.h
> @@ -11,6 +11,8 @@
>
> #include <linux/pci_ids.h>
>
> +#define PCI_VENDOR_ID_LECARC 0x0720
[Severity: Low]
This isn't a bug, but the v2 changelog claims spaces were replaced with a
tab, while this macro definition still uses 11 spaces.
[Severity: High]
This is a pre-existing issue, but enabling the LECARC vendor ID exposes these
platforms to a flaw in drivers/perf/dwc_pcie_pmu.c.
Does dwc_pcie_pmu_probe() trigger a use-after-free if the device is removed?
drivers/perf/dwc_pcie_pmu.c:dwc_pcie_pmu_probe() {
...
pci_dev_put(pdev);
...
pcie_pmu->pdev = pdev;
...
}
The driver retrieves the PCI device and increments its reference count, but
explicitly drops the reference with pci_dev_put() while retaining the pointer
in pcie_pmu->pdev.
If the device is hot-removed, the PCI core drops its reference and frees the
device structure. If a userspace process holds an open perf event and reads
from it, wouldn't callbacks like dwc_pcie_pmu_read_lane_event_counter()
dereference the freed pcie_pmu->pdev pointer?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260721-pcie-pmu-v4-1-850a4e695b19@lecomputing.com?part=1
next prev parent reply other threads:[~2026-07-21 6:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 6:21 [PATCH v4 v4] PCI: dwc: Add PCI ID for LECARC PCIe pmu Braden Zhang
2026-07-21 6:36 ` Manivannan Sadhasivam
2026-07-21 8:04 ` Braden Zhang
2026-07-21 8:09 ` Braden Zhang
2026-07-21 6:49 ` sashiko-bot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-07-13 2:10 [PATCH v3 v3] PCI: dwc: Add pci id for LECARC pcie pmu Braden Zhang
2026-07-13 2:31 ` sashiko-bot
2026-07-13 5:14 ` Manivannan Sadhasivam
2026-07-20 7:43 ` Braden Zhang
2026-07-20 12:31 ` Manivannan Sadhasivam
2026-07-13 17:38 ` Bjorn Helgaas
2026-07-21 2:04 ` [v3,v3] " Braden Zhang
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=20260721064933.632281F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=braden_zhang@lecomputing.com \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.