Patchwork net-next-2.6 PATCH 1/4] vxge: Fix a possible memory leak in vxge_hw_device_initialize().

login
register
mail settings
Submitter Sreenivasa Honnur
Date April 8, 2010, 8:42 a.m.
Message ID <Pine.GSO.4.10.11004080441240.365-100000@guinness>
Download mbox | patch
Permalink /patch/49709/
State Accepted
Delegated to: David Miller
Headers show

Comments

Sreenivasa Honnur - April 8, 2010, 8:42 a.m.
- Fix a possible memory leak in vxge_hw_device_initialize(). Free hldev if
vxge_hw_device_reg_addr_get() fails.
 
Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@exar.com>
Signed-off-by: Ramkrishna Vepa <ram.vepa@exar.com>
---

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - April 8, 2010, 8:44 a.m.
From: Sreenivasa Honnur <Sreenivasa.Honnur@neterion.com>
Date: Thu, 8 Apr 2010 04:42:02 -0400 (EDT)

> - Fix a possible memory leak in vxge_hw_device_initialize(). Free hldev if
> vxge_hw_device_reg_addr_get() fails.
>  
> Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@exar.com>
> Signed-off-by: Ramkrishna Vepa <ram.vepa@exar.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff -urpN orig/drivers/net/vxge/vxge-config.c patch1/drivers/net/vxge/vxge-config.c
--- orig/drivers/net/vxge/vxge-config.c	2010-04-01 12:03:33.000000000 +0530
+++ patch1/drivers/net/vxge/vxge-config.c	2010-04-01 12:05:55.000000000 +0530
@@ -634,8 +634,10 @@  vxge_hw_device_initialize(
 	__vxge_hw_device_pci_e_init(hldev);
 
 	status = __vxge_hw_device_reg_addr_get(hldev);
-	if (status != VXGE_HW_OK)
+	if (status != VXGE_HW_OK) {
+		vfree(hldev);
 		goto exit;
+	}
 	__vxge_hw_device_id_get(hldev);
 
 	__vxge_hw_device_host_info_get(hldev);