[PATCH v14 3/7] PCI: Fail FLR when config space is inaccessible

Farhan Ali
2026-04-21T16:30:50Z

If a device is in an error state, then it's config space may not be
accssible. Add additional check to validate if a device's config space is
accessible before doing an FLR reset.

Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
---
drivers/pci/pci.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e71b81415392..c50418f5e318 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4396,6 +4396,9 @@ int pcie_reset_flr(struct pci_dev *dev, bool probe)
if (!(dev->devcap & PCI_EXP_DEVCAP_FLR))
return -ENOTTY;

+ if (!pci_dev_config_accessible(dev, "FLR"))
+ return -ENOTTY;
+
if (probe)
return 0;

--
2.43.0