* [PATCH net] enic: free all rq buffs when allocation fails
@ 2015-01-02 15:23 Govindarajulu Varadarajan
2015-01-02 21:44 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Govindarajulu Varadarajan @ 2015-01-02 15:23 UTC (permalink / raw)
To: davem, netdev; +Cc: ssujith, benve, Govindarajulu Varadarajan
When allocation of all RQs fail, we do not free previously allocated buffers,
before returning error. This causes memory leak.
This patch fixes this by calling vnic_rq_clean(), which frees all the rq
buffers.
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 705f334..b29e027 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -1616,7 +1616,7 @@ static int enic_open(struct net_device *netdev)
if (vnic_rq_desc_used(&enic->rq[i]) == 0) {
netdev_err(netdev, "Unable to alloc receive buffers\n");
err = -ENOMEM;
- goto err_out_notify_unset;
+ goto err_out_free_rq;
}
}
@@ -1649,7 +1649,9 @@ static int enic_open(struct net_device *netdev)
return 0;
-err_out_notify_unset:
+err_out_free_rq:
+ for (i = 0; i < enic->rq_count; i++)
+ vnic_rq_clean(&enic->rq[i], enic_free_rq_buf);
enic_dev_notify_unset(enic);
err_out_free_intr:
enic_free_intr(enic);
--
2.2.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] enic: free all rq buffs when allocation fails
2015-01-02 15:23 [PATCH net] enic: free all rq buffs when allocation fails Govindarajulu Varadarajan
@ 2015-01-02 21:44 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-01-02 21:44 UTC (permalink / raw)
To: _govind; +Cc: netdev, ssujith, benve
From: Govindarajulu Varadarajan <_govind@gmx.com>
Date: Fri, 2 Jan 2015 20:53:27 +0530
> When allocation of all RQs fail, we do not free previously allocated buffers,
> before returning error. This causes memory leak.
>
> This patch fixes this by calling vnic_rq_clean(), which frees all the rq
> buffers.
>
> Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
Looks good, applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-02 21:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-02 15:23 [PATCH net] enic: free all rq buffs when allocation fails Govindarajulu Varadarajan
2015-01-02 21:44 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).