[lvc-project] [PATCH 5.10.y] PCI: Check parent for NULL in of_pci_bus_release_domain_nr()
Sergey Shtylyov
s.shtylyov at omp.ru
Wed Mar 11 23:28:30 MSK 2026
From: Sergey Shtylyov <s.shtylyov at auroraos.dev>
[ Upstream commit f7245901de8978d829f80b3d8e36ed9a8fd18049 ]
of_pci_bus_find_domain_nr() allows its parent parameter to be NULL but
of_pci_bus_release_domain_nr() (that undoes its effect) doesn't -- that
means it's going to blow up while calling of_get_pci_domain_nr() if the
parent parameter indeed happens to be NULL. Add the missing NULL check.
Found by Linux Verification Center (linuxtesting.org) with the Svace static
analysis tool.
Fixes: c14f7ccc9f5d ("PCI: Assign PCI domain IDs by ida_alloc()")
Signed-off-by: Sergey Shtylyov <s.shtylyov at auroraos.dev>
Signed-off-by: Bjorn Helgaas <bhelgaas at google.com>
Link: https://patch.msgid.link/20260127203944.28588-1-s.shtylyov@auroraos.dev
---
drivers/pci/pci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-stable/drivers/pci/pci.c
===================================================================
--- linux-stable.orig/drivers/pci/pci.c
+++ linux-stable/drivers/pci/pci.c
@@ -6533,7 +6533,7 @@ static void of_pci_bus_release_domain_nr
return;
/* Release domain from IDA where it was allocated. */
- if (of_get_pci_domain_nr(parent->of_node) == bus->domain_nr)
+ if (parent && of_get_pci_domain_nr(parent->of_node) == bus->domain_nr)
ida_free(&pci_domain_nr_static_ida, bus->domain_nr);
else
ida_free(&pci_domain_nr_dynamic_ida, bus->domain_nr);
More information about the lvc-project
mailing list