aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimmy Li <[email protected]>2017-05-22 16:48:28 +0100
committerCatalin Marinas <[email protected]>2017-05-25 16:52:58 +0100
commit717902cc93118119a6fce7765da6cf2786987418 (patch)
tree16546ce2cb33a4d6595008858d33dda5bb980607
parent63a1e1c95e60e798fa09ab3c536fb555aa5bbf2b (diff)
ARM64: PCI: Fix struct acpi_pci_root_ops allocation failure path
Commit 093d24a20442 ("arm64: PCI: Manage controller-specific data on per-controller basis") added code to allocate ACPI PCI root_ops dynamically on a per host bridge basis but failed to update the corresponding memory allocation failure path in pci_acpi_scan_root() leading to a potential memory leakage. Fix it by adding the required kfree call. Fixes: 093d24a20442 ("arm64: PCI: Manage controller-specific data on per-controller basis") Reviewed-by: Tomasz Nowicki <[email protected]> Signed-off-by: Timmy Li <[email protected]> [[email protected]: refactored code, rewrote commit log] Signed-off-by: Lorenzo Pieralisi <[email protected]> CC: Will Deacon <[email protected]> CC: Bjorn Helgaas <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
-rw-r--r--arch/arm64/kernel/pci.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
index 4f0e3ebfea4b..c7e3e6387a49 100644
--- a/arch/arm64/kernel/pci.c
+++ b/arch/arm64/kernel/pci.c
@@ -191,8 +191,10 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
return NULL;
root_ops = kzalloc_node(sizeof(*root_ops), GFP_KERNEL, node);
- if (!root_ops)
+ if (!root_ops) {
+ kfree(ri);
return NULL;
+ }
ri->cfg = pci_acpi_setup_ecam_mapping(root);
if (!ri->cfg) {