public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM/PCI: bios32: Fix pcibios_init_resource() error return path
@ 2017-07-10 12:34 Lorenzo Pieralisi
  2017-07-10 12:34 ` [PATCH 2/2] MIPS/PCI: Fix pcibios_scan_bus() NULL check code path Lorenzo Pieralisi
  2017-07-10 14:57 ` [PATCH 1/2] ARM/PCI: bios32: Fix pcibios_init_resource() error return path Bjorn Helgaas
  0 siblings, 2 replies; 6+ messages in thread
From: Lorenzo Pieralisi @ 2017-07-10 12:34 UTC (permalink / raw)
  To: linux-pci
  Cc: linux-kernel, Lorenzo Pieralisi, Jason Cooper, Bjorn Helgaas,
	Russell King, Andrew Lunn

Since commit 97ad2bdcbe85 ("ARM/PCI: Convert PCI scan API to
pci_scan_root_bus_bridge()") struct pci_sys_data is allocated through
pci_alloc_host_bridge() which implies that, if pcibios_init_resource()
fails, the pci_sys_data should be freed along with struct pci_host_bridge
members through pci_free_host_bridge() instead of a simple kfree.

Fix commit 97ad2bdcbe85 ("ARM/PCI: Convert PCI scan API to
pci_scan_root_bus_bridge()") by updating pcibios_init_resource()
error path.

Fixes: 97ad2bdcbe85 ("ARM/PCI: Convert PCI scan API to pci_scan_root_bus_bridge()")
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Jason Cooper <jason@lakedaemon.net>
CC: Bjorn Helgaas <bhelgaas@google.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>
---
 arch/arm/kernel/bios32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 56dc1a3..c1809fb 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -480,7 +480,7 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
 
 			ret = pcibios_init_resource(nr, sys, hw->io_optional);
 			if (ret)  {
-				kfree(sys);
+				pci_free_host_bridge(bridge);
 				break;
 			}
 
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-07-10 16:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-10 12:34 [PATCH 1/2] ARM/PCI: bios32: Fix pcibios_init_resource() error return path Lorenzo Pieralisi
2017-07-10 12:34 ` [PATCH 2/2] MIPS/PCI: Fix pcibios_scan_bus() NULL check code path Lorenzo Pieralisi
2017-07-10 14:55   ` Bjorn Helgaas
2017-07-10 15:49     ` Lorenzo Pieralisi
2017-07-10 16:38       ` Bjorn Helgaas
2017-07-10 14:57 ` [PATCH 1/2] ARM/PCI: bios32: Fix pcibios_init_resource() error return path Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox