From 029c3c133ba2c3e0e48fdfacc08324bb3fa2a571 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Sat, 22 Mar 2008 00:07:13 +0100 Subject: PCI: Hotplug: Fix leaks in IBM Hot Plug Controller Driver - ibmphp_init_devno() In drivers/pci/hotplug/ibmphp_core.c::ibmphp_init_devno() we allocate space dynamically for a PCI irq routing table by calling pcibios_get_irq_routing_table(), but we never free the allocated space. This patch frees the allocated space at the function exit points. Spotted by the Coverity checker. Compile tested only. Please consider applying. Signed-off-by: Jesper Juhl Signed-off-by: Greg Kroah-Hartman --- drivers/pci/hotplug/ibmphp_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/pci') diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c index 87b6b8b280e..81d00922918 100644 --- a/drivers/pci/hotplug/ibmphp_core.c +++ b/drivers/pci/hotplug/ibmphp_core.c @@ -148,8 +148,10 @@ int ibmphp_init_devno(struct slot **cur_slot) len = (rtable->size - sizeof(struct irq_routing_table)) / sizeof(struct irq_info); - if (!len) + if (!len) { + kfree(rtable); return -1; + } for (loop = 0; loop < len; loop++) { if ((*cur_slot)->number == rtable->slots[loop].slot) { if ((*cur_slot)->bus == rtable->slots[loop].bus) { @@ -187,11 +189,13 @@ int ibmphp_init_devno(struct slot **cur_slot) debug("rtable->slots[loop].irq[3].link = %x\n", rtable->slots[loop].irq[3].link); debug("end of init_devno\n"); + kfree(rtable); return 0; } } } + kfree(rtable); return -1; } -- cgit v1.2.3-70-g09d2