Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1200810 > unrolled thread

[PATCH] igb: Fix a memory leak in igb_probe

Started byJia-Ju Bai <baijiaju1990@163.com>
First post2015-08-05 16:10 +0200
Last post2015-08-11 04:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] igb: Fix a memory leak in igb_probe Jia-Ju Bai <baijiaju1990@163.com> - 2015-08-05 16:10 +0200
    RE: [PATCH] igb: Fix a memory leak in igb_probe "Brown, Aaron F" <aaron.f.brown@intel.com> - 2015-08-11 04:20 +0200

#1200810 — [PATCH] igb: Fix a memory leak in igb_probe

FromJia-Ju Bai <baijiaju1990@163.com>
Date2015-08-05 16:10 +0200
Subject[PATCH] igb: Fix a memory leak in igb_probe
Message-ID<pU7yh-3zf-7@gated-at.bofh.it>
In error handling code of igb_probe, the memory adapter->shadow_vfta 
allocated by kcalloc in igb_sw_init is not freed. So when register_netdev 
or igb_init_i2c is failed, a memory leak will occur.
This patch adds kfree to fix it.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 2f70a9b..3efb757 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2645,6 +2645,7 @@ err_eeprom:
 	if (hw->flash_address)
 		iounmap(hw->flash_address);
 err_sw_init:
+	kfree(adapter->shadow_vfta);
 	igb_clear_interrupt_scheme(adapter);
 	pci_iounmap(pdev, hw->hw_addr);
 err_ioremap:
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1204693

From"Brown, Aaron F" <aaron.f.brown@intel.com>
Date2015-08-11 04:20 +0200
Message-ID<pW7kt-8aE-3@gated-at.bofh.it>
In reply to#1200810
> From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
> On Behalf Of Jia-Ju Bai
> Sent: Wednesday, August 05, 2015 7:05 AM
> To: Kirsher, Jeffrey T; Brandeburg, Jesse
> Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; Jia-Ju Bai
> Subject: [PATCH] igb: Fix a memory leak in igb_probe
> 
> In error handling code of igb_probe, the memory adapter->shadow_vfta
> allocated by kcalloc in igb_sw_init is not freed. So when register_netdev
> or igb_init_i2c is failed, a memory leak will occur.
> This patch adds kfree to fix it.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
> ---
>  drivers/net/ethernet/intel/igb/igb_main.c |    1 +
>  1 file changed, 1 insertion(+)

Tested-by: Aaron Brown <aaron.f.brown@intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web