From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=210.13.118.86 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796109919; b=HaVK+hw0WO/XUvAfT0OlteYFmA4ScNnXAHxRB9ZPESK3+zTB14sd7vwhLR1lBevwXdfc qu6TQFf49pk1OTuG2cQ7lq2gSte8MPEMEDLT0nxfmGfTpnp6uZai39LrPvIToekizy/fU 6hvhsNMt+qZBO+IasuLHgtRV0cDb6b992odO38pkbMGire5OIXac1tbFlwG6tAwsrUD0h JA6FxD8hij384cVHQ+khQWh2uRVIHfQBtsBxu9i6oIEPx7mZbeG//NsbPSlZ4zGKq7rvB 01rb5ln5SHOIMnaCiul8gCngWNm9piJpmLT3ujvhGgNNwpxztHlsILax4mayA1e6SWA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796109919; h=DMARC-Filter:Received:Received:From:To:CC:Subject:Date:Message-ID: X-Mailer:MIME-Version:Content-Transfer-Encoding:Content-Type: X-Originating-IP:X-ClientProxiedBy:X-DNSRBL:X-SPAM-SOURCE-CHECK: X-MAIL; bh=1642k7PmGA1f2GDWVDl7NggXkL9xtBuI2iQjxaVCSLQ=; b=yK+zQbahZXSsPRTSriBZ+Tlw5Ig8MOZ/Qz3DqE7Gua4b2sbVxBp/+4vovOXZzPfdWxQ2 jFfvEYeLKsNtg4lneP91pafrFZ73c4WL+rdWRTKIJTQGHpez83e6CHD+2yaxl+NRxzktm QbtWxy+wkgBTeQasdzdlTvEpdR1WF5BuUESQ3keeNYfF2Zu3rB/SHwKMSww0oJFECwkac vf1wWampurtIvMNQhDpfQlTBLcgkU7HsXwCXyNKaRV2SueBLeoM7q0/6uPS7NQdejLCjq R4TilowEEQJ6jJclwb/yC5ii+xTBer1pIm3KtuvJl//zR7KCwQeTaeRMfOlmLUE9aog== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=asrmicro.com; spf=pass smtp.mailfrom=asrmicro.com; arc=none smtp.remote-ip=210.13.118.86 Received: from spam.asrmicro.com (asrmicro.com [210.13.118.86]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA54A606A687; Tue, 1 Dec 2026 07:25:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CA54A606A687 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=asrmicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=asrmicro.com Received: from sh-exch01.asrmicro.com (sh-exch01.asrmicro.com [10.1.24.97]) by spam.asrmicro.com with ESMTPS id 6B17P2KO036040 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 1 Dec 2026 15:25:02 +0800 (GMT-8) (envelope-from xianhutan@asrmicro.com) Received: from asrmicro.com (10.26.130.183) by sh-exch01.asrmicro.com (10.1.24.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_RSA_WITH_AES_128_CBC_SHA) id 15.2.1748.39; Tue, 1 Dec 2026 15:25:04 +0800 From: To: CC: , Subject: [PATCH] PCI/PM: Reject invalid PMCSR when checking PME status Date: Tue, 1 Dec 2026 15:25:01 +0800 Message-ID: <20261201072501.2340605-1-xianhutan@asrmicro.com> X-Mailer: git-send-email 2.34.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: sh-exch01.asrmicro.com (10.1.24.97) To sh-exch01.asrmicro.com (10.1.24.97) X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL:spam.asrmicro.com 6B17P2KO036040 From: Xianhu Tan pci_check_pme_status() reads PMCSR and tests PME_STATUS without checking whether the configuration read succeeded or returned a valid value. When the device or its upstream bridge is inaccessible, the configuration read may fail or return all ones. Since bit 15 of 0xffff is set, the PCI core incorrectly interprets the PME_STATUS bit as asserted and reports a spurious PME event, triggering a runtime resume of an already suspended device. The issue occurs in pci_pme_list_scan(), which scans the PME device list and calls pci_check_pme_status() for each entry. On the affected platform, a device that has just entered D3hot with the PCIe link in L1 may return 0xffff when PMCSR is read, causing the PME scan to incorrectly trigger a runtime resume. Check the return value of pci_read_config_word() and reject an all-ones PMCSR before checking PME_STATUS. This also prevents writing PMCSR back to an inaccessible device. Tested on: - ARM32 platform with PCIe endpoint. Test cases: - PMCSR read returns 0xffff: no false PME event is reported. - Normal PME status handling remains unchanged. Signed-off-by: Xianhu Tan --- drivers/pci/pci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 7c6f2aba8..d1f8ff856 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -2323,6 +2323,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; @@ -2330,7 +2331,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; + if (!(pmcsr & PCI_PM_CTRL_PME_STATUS)) return false; -- 2.34.1