[PATCH v13 12/15] PCI/CXL: Reject reset with unsafe function scope

From: Srirangan Madhavan

Date: Tue Sep 22 2026 - 04:44:17 EST


The per-device PCI reset interface must not reset sibling functions.
Reject cxl_reset and cxl_bus for multifunction devices and PFs with
enabled VFs.

Reported-by: Alex Williamson <alwilliamson@xxxxxxxxxx>
Link: https://lore.kernel.org/linux-cxl/20260626160846.426e71b6@xxxxxxxxxx/
Link: https://lore.kernel.org/linux-cxl/6a50441e2bb5e_3cabcb1003e@djbw-dev.notmuch/
Signed-off-by: Srirangan Madhavan <smadhavan@xxxxxxxxxx>
---
drivers/cxl/core/resource.c | 3 +++
drivers/pci/pci.c | 3 +++
2 files changed, 6 insertions(+)

diff --git a/drivers/cxl/core/resource.c b/drivers/cxl/core/resource.c
index 85a554b6236c..249b1280f3d3 100644
--- a/drivers/cxl/core/resource.c
+++ b/drivers/cxl/core/resource.c
@@ -859,6 +859,9 @@ int cxl_reset_function(struct pci_dev *pdev, bool probe)
!(ctrl & PCI_DVSEC_CXL_MEM_ENABLE))
return -ENOTTY;

+ if (pdev->multifunction || pci_num_vf(pdev))
+ return -ENOTTY;
+
if (probe)
return 0;

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b2879a6be5f8..fe611340f5ab 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5026,6 +5026,9 @@ static int cxl_reset_bus_function(struct pci_dev *dev, bool probe)
if (!dvsec)
return -ENOTTY;

+ if (dev->multifunction || pci_num_vf(dev))
+ return -ENOTTY;
+
if (probe)
return 0;

--
2.43.0