From: sashiko-bot@kernel.org
To: xianhutan@asrmicro.com, linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI/PM: Reject invalid PMCSR when checking PME status
Date: Tue, 01 Dec 2026 07:32:27 +0000 [thread overview]
Message-ID: <sashiko-outbox-242775@kernel.org> (raw)
In-Reply-To: <20261201072501.2340605-1-xianhutan@asrmicro.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] PCI: unchecked config reads in pci_enable_acs() [1]
--
commit 8c12dc3e4ecd98aae67c8154c4081c2845c8cd6c
Author: Xianhu Tan <xianhutan@asrmicro.com>
PCI/PM: Reject invalid PMCSR when checking PME status
This commit checks the return value of pci_read_config_word() and rejects
an all-ones PMCSR value in pci_check_pme_status() to avoid reporting
spurious PME events and writing back to inaccessible devices.
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index de0d2fa15be10..36e6099af9a88 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -2485,6 +2485,7 @@ void pcie_clear_root_pme_status(struct pci_dev *dev)
> bool pci_check_pme_status(struct pci_dev *dev)
> {
> int pmcsr_pos;
> + int rc;
> u16 pmcsr;
> bool ret = false;
>
> @@ -2492,7 +2493,10 @@ bool pci_check_pme_status(struct pci_dev *dev)
> return false;
>
> pmcsr_pos = dev->pm_cap + PCI_PM_CTRL;
> - pci_read_config_word(dev, pmcsr_pos, &pmcsr);
> + rc = pci_read_config_word(dev, pmcsr_pos, &pmcsr);
> + if (rc != PCIBIOS_SUCCESSFUL || pmcsr == 0xffff)
> + return false;
[Severity: Critical]
This problem wasn't introduced by this patch, but can unchecked config
reads in pci_enable_acs() and the Intel ACS quirks [1] corrupt
PCI_ACS_CTRL or arbitrary MMIO space when a config read fails and populates
~0?
In pci_enable_acs(), caps.ctrl is read without checking for a failed read
or 0xffff before modifying and writing it back:
drivers/pci/pci.c:pci_enable_acs() {
...
pci_read_config_word(dev, pos + PCI_ACS_CTRL, &caps.ctrl);
caps.fw_ctrl = caps.ctrl;
...
pci_write_config_word(dev, pos + PCI_ACS_CTRL, caps.ctrl);
}
Similarly, pci_quirk_enable_intel_lpc_acs() reads INTEL_LPC_RCBA_REG into
rcba without checking for ~0; an all-ones value passes the
INTEL_LPC_RCBA_ENABLE test, causing the quirk to ioremap() 0xffffc000 and
call writel() on it.
[1] https://sashiko.dev/#/bug/linux-184296e9-829b-490a-84f9-32f74e109f5e
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201072501.2340605-1-xianhutan@asrmicro.com?part=1
next prev parent reply other threads:[~2026-12-01 7:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 7:25 [PATCH] PCI/PM: Reject invalid PMCSR when checking PME status xianhutan
2026-12-01 7:32 ` sashiko-bot [this message]
2026-12-01 10:20 ` Lukas Wunner
2026-12-02 6:08 ` Xianhu Tan
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=sashiko-outbox-242775@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=xianhutan@asrmicro.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 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.