On Wed, Nov 18, 2026 at 04:11:48PM +0100, Pierre Gondois wrote: > Hello Lukas, Kuppuswamy, > > On 11/17/26 19:57, Kuppuswamy Sathyanarayanan wrote: > > > > On 11/17/26 03:50, Lukas Wunner wrote: > > > On Tue, Nov 17, 2026 at 12:10:29PM +0100, Pierre Gondois wrote: > > > > Return PCI_ERS_RESULT_DISCONNECT when no upstream bridge is available, > > > > avoiding a NULL pointer dereference in pci_walk_bridge(). > > > How can that happen? If it can happen (which I doubt), why isn't this > > > patch tagged for stable? > > One way I can see is a device without a PCIe capability on a root bus. > > pci_pcie_type() returns 0, which is PCI_EXP_TYPE_ENDPOINT, and > > pci_upstream_bridge() returns NULL. Native AER never gets there. Only > > firmware-first can, through aer_recover_work_func(), and only if > > firmware reports a PCIe error section for such a device. If that is > > the case, skipping recovery for !pci_is_pcie(pdev) in > > aer_recover_work_func() seems a better fit than a check in > > pcie_do_recovery(). > > > > > Why is it at the end of this series? Does the series somehow make it > > > possible that there's no upstream bridge? Which patch does that? > > > If the preceding patches are not the cause of a potential NULL > > > pointer deref, why isn't this patch submitted separately from the series? > > To test this serie, I generated and injected synthetic CPER records. > The PCI device referenced in some synthetic CPER records did not > actually exist. In such case, the kernel crashes due to a NULL > pointer deferencement. > > This use case is indeed slightly unsusual and unlikely to happen > in the real world. The patch was still included in the serie. > > Please let me know if the patch should be either dropped or better > documented.
It would be good to include these details in the commit message. Also, I agree it is fair to be prepared for, and gracefully handle, unexpected data from firmware. A platform may report a CPER to OS with the intention that the data is only for reporting purposes, not recovery action. **BUT**, we could argue this is a platform bug. CPER serverity is one item used to decide if recovery should be attempted. The platform should not report a severity that indicates recovery/action is needed while giving bogus/incomplete data. If the platform is intending to share data for reporting only, then the CPER severity should be set appropriately. Otherwise, this should be a big FW_BUG message "Platform reported recoverable error for unknown device." Thanks, Yazen
