Re: [PATCH v3] PCI: of_property: Omit bus properties without a subordinate bus
From: Herve Codina
Date: Tue Nov 03 2026 - 08:46:03 EST
Hi Bjorn,
On Fri, 18 Sep 2026 15:20:45 -0500
Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote:
> On Fri, Sep 18, 2026 at 02:55:40PM -0500, Bjorn Helgaas wrote:
> > Author: Angel J <iamanaws@xxxxxxxxx>
> >
> > PCI: of_property: Omit bus properties without a subordinate bus
> >
> > A bridge (a device with a Type 1 header) may not have a secondary bus
> > allocated (pdev->subordinate), e.g., if there are no available bus numbers
> > or the bridge secondary/subordinate bus numbers are not writable.
> >
> > The dynamic OF helpers of_pci_prop_bus_range() and of_pci_prop_intr_map()
> > dereference pdev->subordinate without checking it. When
> > CONFIG_PCI_DYNAMIC_OF_NODES is enabled, this can cause a NULL pointer
> > dereference and early boot hang.
> >
> > Generate 'bus-range' and 'interrupt-map' properties only when a subordinate
> > bus exists. Keep the node and its remaining properties for bridges without
> > one.
> >
> > The problem was latent since 407d1a51921e ("PCI: Create device tree node
> > for bridge"), but wasn't reachable until 1f340724419e ("PCI: of: Create
> > device tree PCI host bridge node"), which appeared in v6.15. Before
> > 1f340724419e, of_pci_make_dev_node() returned early because the parent OF
> > node was missing.
> >
> > Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
> > Signed-off-by: Angel J <iamanaws@xxxxxxxxx>
> > [bhelgaas: move pdev->subordinate test to callees, commit log]
> > Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> > Cc: stable@xxxxxxxxxxxxxxx # v6.6+
> > Link: https://patch.msgid.link/20260912043106.10715-1-iamanaws@xxxxxxxxx
>
> I put this on pci/for-linus, planning to be in v7.3, but I would love
> to have testing reports to make sure it still works as the v2 does.
I know it's too late to add a tag but well, just to mention my test somewhere:
It works for the LAN966x use case. Tested with v7.4-rc1.
Tested-by: Herve Codina <herve.codina@xxxxxxxxxxx>
Best regards,
Hervé