drivers/pci/of.c | 4 ++++ 1 file changed, 4 insertions(+)
A device can satisfy pci_is_bridge() without having a subordinate bus.
The dynamic OF helpers for bus-range and interrupt-map dereference
pdev->subordinate without checking it.
On a Dell XPS 8940, device 0000:00:00.0 [8086:4c43] has no subordinate
bus, and enabling CONFIG_PCI_DYNAMIC_OF_NODES causes an early boot hang.
Skip dynamic OF node creation for bridges without a subordinate bus.
This allows the machine to boot while preserving node creation for the
other bridges.
Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
Cc: stable@vger.kernel.org
Signed-off-by: Angel J <iamanaws@httpd.dev>
---
drivers/pci/of.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index a51dff91b..971c79c2a 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -765,6 +765,10 @@ void of_pci_make_dev_node(struct pci_dev *pdev)
if (!ppnode)
return;
+ /* Bridge properties require a subordinate bus. */
+ if (pci_is_bridge(pdev) && !pdev->subordinate)
+ return;
+
if (pci_is_bridge(pdev))
pci_type = "pci";
else
--
2.54.0
A device can satisfy pci_is_bridge() without having a subordinate bus.
The dynamic OF helpers for bus-range and interrupt-map dereference
pdev->subordinate without checking it.
On a Dell XPS 8940, device 0000:00:00.0 [8086:4c43] has no subordinate
bus, and enabling CONFIG_PCI_DYNAMIC_OF_NODES causes an early boot hang.
Generate bus-range and interrupt-map only when a subordinate bus exists.
Keep the node and its remaining properties for bridges without one.
Boot-tested on Linux 6.18.44 with CONFIG_PCI_DYNAMIC_OF_NODES=y. The
system boots and the node for 00:00.0 retains device_type, reg and
compatible. The other bridges retain their nodes and bus ranges.
Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
Cc: stable@vger.kernel.org
Signed-off-by: Angel J <iamanaws@httpd.dev>
---
Changes in v2:
- Keep the dynamic OF node and skip only bus-range and interrupt-map
when no subordinate bus exists, following review of v1.
- Tested on Linux 6.18.44 with the v1 guard removed.
drivers/pci/of_property.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c
index 75a358f73..acd2e0f70 100644
--- a/drivers/pci/of_property.c
+++ b/drivers/pci/of_property.c
@@ -361,13 +361,15 @@ int of_pci_add_properties(struct pci_dev *pdev, struct of_changeset *ocs,
if (ret)
return ret;
- ret = of_pci_prop_bus_range(pdev, ocs, np);
- if (ret)
- return ret;
+ if (pdev->subordinate) {
+ ret = of_pci_prop_bus_range(pdev, ocs, np);
+ if (ret)
+ return ret;
- ret = of_pci_prop_intr_map(pdev, ocs, np);
- if (ret)
- return ret;
+ ret = of_pci_prop_intr_map(pdev, ocs, np);
+ if (ret)
+ return ret;
+ }
} else {
ret = of_pci_prop_intr_ctrl(pdev, ocs, np);
if (ret)
--
2.54.0
On Fri, Sep 11, 2026 at 09:31:06PM -0700, Angel J wrote:
> A device can satisfy pci_is_bridge() without having a subordinate bus.
> The dynamic OF helpers for bus-range and interrupt-map dereference
> pdev->subordinate without checking it.
>
> On a Dell XPS 8940, device 0000:00:00.0 [8086:4c43] has no subordinate
> bus, and enabling CONFIG_PCI_DYNAMIC_OF_NODES causes an early boot hang.
>
> Generate bus-range and interrupt-map only when a subordinate bus exists.
> Keep the node and its remaining properties for bridges without one.
>
> Boot-tested on Linux 6.18.44 with CONFIG_PCI_DYNAMIC_OF_NODES=y. The
> system boots and the node for 00:00.0 retains device_type, reg and
> compatible. The other bridges retain their nodes and bus ranges.
I think this is the right approach, with something like this included
in the commit log:
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.
I don't think it's necessary to connect this with [8086:4c43] because
I think this situation is very common, and I don't want to leave the
impression that it's related to a Dell system or to that specific
device. It's just a bug to assume that pci_is_bridge() implies
pdev->subordinate is valid.
> Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
> Cc: stable@vger.kernel.org
> Signed-off-by: Angel J <iamanaws@httpd.dev>
> ---
> Changes in v2:
> - Keep the dynamic OF node and skip only bus-range and interrupt-map
> when no subordinate bus exists, following review of v1.
> - Tested on Linux 6.18.44 with the v1 guard removed.
>
> drivers/pci/of_property.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c
> index 75a358f73..acd2e0f70 100644
> --- a/drivers/pci/of_property.c
> +++ b/drivers/pci/of_property.c
> @@ -361,13 +361,15 @@ int of_pci_add_properties(struct pci_dev *pdev, struct of_changeset *ocs,
> if (ret)
> return ret;
>
> - ret = of_pci_prop_bus_range(pdev, ocs, np);
> - if (ret)
> - return ret;
> + if (pdev->subordinate) {
> + ret = of_pci_prop_bus_range(pdev, ocs, np);
> + if (ret)
> + return ret;
>
> - ret = of_pci_prop_intr_map(pdev, ocs, np);
> - if (ret)
> - return ret;
> + ret = of_pci_prop_intr_map(pdev, ocs, np);
> + if (ret)
> + return ret;
I think this is the best solution, but I do think it would be a little
cleaner to check for pdev->subordinate inside of_pci_prop_bus_range()
and of_pci_prop_intr_map() instead of assuming things here about the
internals of those functions. We could just make them return
immediately without doing anything.
> + }
> } else {
> ret = of_pci_prop_intr_ctrl(pdev, ocs, np);
> if (ret)
> --
> 2.54.0
>
Author: Angel J <iamanaws@httpd.dev>
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@httpd.dev>
[bhelgaas: move pdev->subordinate test to callees, commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org # v6.6+
Link: https://patch.msgid.link/20260912043106.10715-1-iamanaws@httpd.dev
---
Changes in v3:
- Move pdev->subordinate tests to of_pci_prop_bus_range() and
of_pci_prop_intr_map()
Changes in v2
(https://lore.kernel.org/all/20260912043106.10715-1-iamanaws@httpd.dev):
- Keep the dynamic OF node and skip only bus-range and interrupt-map
when no subordinate bus exists, following review of v1.
- Tested on Linux 6.18.44 with the v1 guard removed.
v1
(https://lore.kernel.org/all/20260911230420.26244-1-iamanaws@httpd.dev)
diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c
index 75a358f73e69..1500740cc55d 100644
--- a/drivers/pci/of_property.c
+++ b/drivers/pci/of_property.c
@@ -95,9 +95,13 @@ static int of_pci_prop_bus_range(struct pci_dev *pdev,
struct of_changeset *ocs,
struct device_node *np)
{
- u32 bus_range[] = { pdev->subordinate->busn_res.start,
- pdev->subordinate->busn_res.end };
+ u32 bus_range[2];
+ if (!pdev->subordinate)
+ return 0;
+
+ bus_range[0] = pdev->subordinate->busn_res.start;
+ bus_range[1] = pdev->subordinate->busn_res.end;
return of_changeset_add_prop_u32_array(ocs, np, "bus-range", bus_range,
ARRAY_SIZE(bus_range));
}
@@ -220,6 +224,9 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs,
int ret;
u8 pin;
+ if (!pdev->subordinate)
+ return 0;
+
pnode = pci_device_to_OF_node(pdev->bus->self);
if (!pnode)
pnode = pci_bus_to_OF_node(pdev->bus);
On Fri, Sep 18, 2026 at 02:55:40PM -0500, Bjorn Helgaas wrote:
> Author: Angel J <iamanaws@httpd.dev>
>
> 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@httpd.dev>
> [bhelgaas: move pdev->subordinate test to callees, commit log]
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> Cc: stable@vger.kernel.org # v6.6+
> Link: https://patch.msgid.link/20260912043106.10715-1-iamanaws@httpd.dev
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.
> ---
> Changes in v3:
> - Move pdev->subordinate tests to of_pci_prop_bus_range() and
> of_pci_prop_intr_map()
>
> Changes in v2
> (https://lore.kernel.org/all/20260912043106.10715-1-iamanaws@httpd.dev):
> - Keep the dynamic OF node and skip only bus-range and interrupt-map
> when no subordinate bus exists, following review of v1.
> - Tested on Linux 6.18.44 with the v1 guard removed.
>
> v1
> (https://lore.kernel.org/all/20260911230420.26244-1-iamanaws@httpd.dev)
>
> diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c
> index 75a358f73e69..1500740cc55d 100644
> --- a/drivers/pci/of_property.c
> +++ b/drivers/pci/of_property.c
> @@ -95,9 +95,13 @@ static int of_pci_prop_bus_range(struct pci_dev *pdev,
> struct of_changeset *ocs,
> struct device_node *np)
> {
> - u32 bus_range[] = { pdev->subordinate->busn_res.start,
> - pdev->subordinate->busn_res.end };
> + u32 bus_range[2];
>
> + if (!pdev->subordinate)
> + return 0;
> +
> + bus_range[0] = pdev->subordinate->busn_res.start;
> + bus_range[1] = pdev->subordinate->busn_res.end;
> return of_changeset_add_prop_u32_array(ocs, np, "bus-range", bus_range,
> ARRAY_SIZE(bus_range));
> }
> @@ -220,6 +224,9 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs,
> int ret;
> u8 pin;
>
> + if (!pdev->subordinate)
> + return 0;
> +
> pnode = pci_device_to_OF_node(pdev->bus->self);
> if (!pnode)
> pnode = pci_bus_to_OF_node(pdev->bus);
I didn't reply cuz I'm out for 3 weeks without access to that machine, so I can't test or confirm it works as expected (even though probably does)
Still, I will try to confirm as soon as I can.
Thanks
On Friday, September 18th, 2026 at 13:20, Bjorn Helgaas <helgaas@kernel.org> wrote:
> On Fri, Sep 18, 2026 at 02:55:40PM -0500, Bjorn Helgaas wrote:
> > Author: Angel J <iamanaws@httpd.dev>
> >
> > 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@httpd.dev>
> > [bhelgaas: move pdev->subordinate test to callees, commit log]
> > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> > Cc: stable@vger.kernel.org # v6.6+
> > Link: https://patch.msgid.link/20260912043106.10715-1-iamanaws@httpd.dev
>
> 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.
>
> > ---
> > Changes in v3:
> > - Move pdev->subordinate tests to of_pci_prop_bus_range() and
> > of_pci_prop_intr_map()
> >
> > Changes in v2
> > (https://lore.kernel.org/all/20260912043106.10715-1-iamanaws@httpd.dev):
> > - Keep the dynamic OF node and skip only bus-range and interrupt-map
> > when no subordinate bus exists, following review of v1.
> > - Tested on Linux 6.18.44 with the v1 guard removed.
> >
> > v1
> > (https://lore.kernel.org/all/20260911230420.26244-1-iamanaws@httpd.dev)
> >
> > diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c
> > index 75a358f73e69..1500740cc55d 100644
> > --- a/drivers/pci/of_property.c
> > +++ b/drivers/pci/of_property.c
> > @@ -95,9 +95,13 @@ static int of_pci_prop_bus_range(struct pci_dev *pdev,
> > struct of_changeset *ocs,
> > struct device_node *np)
> > {
> > - u32 bus_range[] = { pdev->subordinate->busn_res.start,
> > - pdev->subordinate->busn_res.end };
> > + u32 bus_range[2];
> >
> > + if (!pdev->subordinate)
> > + return 0;
> > +
> > + bus_range[0] = pdev->subordinate->busn_res.start;
> > + bus_range[1] = pdev->subordinate->busn_res.end;
> > return of_changeset_add_prop_u32_array(ocs, np, "bus-range", bus_range,
> > ARRAY_SIZE(bus_range));
> > }
> > @@ -220,6 +224,9 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs,
> > int ret;
> > u8 pin;
> >
> > + if (!pdev->subordinate)
> > + return 0;
> > +
> > pnode = pci_device_to_OF_node(pdev->bus->self);
> > if (!pnode)
> > pnode = pci_bus_to_OF_node(pdev->bus);
>
© 2016 - 2026 Red Hat, Inc.