ACPI fix for 6.16-rc4

Revert a commit that attempted to fix a memory leak in an error code
 path and introduced a different issue (Zhe Qiao).
 -----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCAAwFiEEcM8Aw/RY0dgsiRUR7l+9nS/U47UFAmhe40QSHHJqd0Byand5
 c29ja2kubmV0AAoJEO5fvZ0v1OO1PtAH+Ick60JqU5I4Ff4r2ES0Ph/HQUd9agwN
 cF0wzZ0wnt55Xq6ADh7JtYcGjFCIoqFDmcp4vj6vuFjuW92lULT01fU8ELV3Ix3h
 u/zL0gwfYogy1a76AO6cSz9ltljFzwlwL4sUkhAapOapf3hq9C4f7TqYm9Zlo6n4
 UGXujN9+5yKqoR0LgyApN5zz9MuNq08rAH+/qdoizM/kzKC3ehXUinYLodEohnCF
 cs6D673538AAlSJItjLjjxZK2ZCCeR2B2C82/v+lz0AXGCqOXWY0ozhqxld79YjZ
 0KtZtgEBl0ahyDBsSG4qnsUXp90eTBLZ+18gsYZSb4eRL+wpuS9WTg==
 =PXSv
 -----END PGP SIGNATURE-----

Merge tag 'acpi-6.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI fix from Rafael Wysocki:
 "Revert a commit that attempted to fix a memory leak in an error code
  path and introduced a different issue (Zhe Qiao)"

* tag 'acpi-6.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  Revert "PCI/ACPI: Fix allocated memory release on error in pci_acpi_scan_root()"
This commit is contained in:
Linus Torvalds 2025-06-27 12:08:36 -07:00
commit 35e261cd95

View file

@ -1676,19 +1676,24 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
return NULL;
root_ops = kzalloc(sizeof(*root_ops), GFP_KERNEL);
if (!root_ops)
goto free_ri;
if (!root_ops) {
kfree(ri);
return NULL;
}
ri->cfg = pci_acpi_setup_ecam_mapping(root);
if (!ri->cfg)
goto free_root_ops;
if (!ri->cfg) {
kfree(ri);
kfree(root_ops);
return NULL;
}
root_ops->release_info = pci_acpi_generic_release_info;
root_ops->prepare_resources = pci_acpi_root_prepare_resources;
root_ops->pci_ops = (struct pci_ops *)&ri->cfg->ops->pci_ops;
bus = acpi_pci_root_create(root, root_ops, &ri->common, ri->cfg);
if (!bus)
goto free_cfg;
return NULL;
/* If we must preserve the resource configuration, claim now */
host = pci_find_host_bridge(bus);
@ -1705,14 +1710,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
pcie_bus_configure_settings(child);
return bus;
free_cfg:
pci_ecam_free(ri->cfg);
free_root_ops:
kfree(root_ops);
free_ri:
kfree(ri);
return NULL;
}
void pcibios_add_bus(struct pci_bus *bus)