PCI: Fix devm_pci_alloc_host_bridge() memory leak
authorJan Kiszka <jan.kiszka@siemens.com>
Tue, 15 May 2018 09:07:01 +0000 (11:07 +0200)
committerBjorn Helgaas <helgaas@kernel.org>
Wed, 30 May 2018 16:34:41 +0000 (11:34 -0500)
Fix a memory leak by freeing the PCI resource list in
devm_pci_release_host_bridge_dev().

Fixes: 5c3f18cce083 ("PCI: Add devm_pci_alloc_host_bridge() interface")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/probe.c

index ac91b6fd0bcd5ac33cb69a02ea4382b50f559f40..eccf204c9160a2285faafa5c681868db10e226b1 100644 (file)
@@ -526,12 +526,14 @@ static void devm_pci_release_host_bridge_dev(struct device *dev)
 
        if (bridge->release_fn)
                bridge->release_fn(bridge);
+
+       pci_free_resource_list(&bridge->windows);
 }
 
 static void pci_release_host_bridge_dev(struct device *dev)
 {
        devm_pci_release_host_bridge_dev(dev);
-       pci_free_host_bridge(to_pci_host_bridge(dev));
+       kfree(to_pci_host_bridge(dev));
 }
 
 struct pci_host_bridge *pci_alloc_host_bridge(size_t priv)