[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1419303290-27565-1-git-send-email-baijiaju1990@163.com>
Date: Tue, 23 Dec 2014 10:54:50 +0800
From: Jia-Ju Bai <baijiaju1990@....com>
To: davem@...emloft.net, nhorman@...driver.com, ebiederm@...ssion.com,
dingtianhong@...wei.com, paul.gortmaker@...driver.com,
justinvanwijngaarden@...il.com
Cc: netdev@...r.kernel.org, Jia-Ju Bai <baijiaju1990@....com>
Subject: [PATCH v3] 3c59x: Fix memory leaks in vortex_open
For linux-3.18.0
The driver calls __netdev_alloc_skb in vortex_open but lacks dev_kfree_skb
when vortex_up is failed, so memory leaks may occur in this situation.
This patch fixes this problem.
Signed-off-by: Jia-Ju Bai <baijiaju1990@....com>
---
drivers/net/ethernet/3com/3c59x.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index 41095eb..d0c5bee 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -1782,6 +1782,16 @@ vortex_open(struct net_device *dev)
if (!retval)
goto out;
+ if (vp->full_bus_master_rx) {
+ for (i = 0; i < RX_RING_SIZE; i++) {
+ if (vp->rx_skbuff[i]) {
+ dev_kfree_skb(vp->rx_skbuff[i]);
+ vp->rx_skbuff[i] = NULL;
+ }
+ }
+ retval = -ENOMEM;
+ }
+
err_free_irq:
free_irq(dev->irq, dev);
err:
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists