diff options
author | Vasily Averin <vvs@sw.ru> | 2006-08-28 17:56:24 -0400 |
---|---|---|
committer | Auke Kok <juke-jan.h.kok@intel.com> | 2006-08-28 17:56:24 -0400 |
commit | 3fbbc72ef172cd4272a43234d4c7a7bba44c97f5 (patch) | |
tree | 94da5cf0359f63ae830c43be61e02fa1816da937 /drivers/net/e1000/e1000_main.c | |
parent | 6dd62ab063ec12bf1343d244d89e09d5c3b79f51 (diff) |
e1000: ring buffers resources cleanup
Memory leak was found in 2.6.18-rc4 and e1000 7.2.7 from sourceforge: We
should free resources allocated for previous rings if following allocation
fails.
Signed-off-by: Vasily Averin <vvs@sw.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Diffstat (limited to 'drivers/net/e1000/e1000_main.c')
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index c273b456d29e..426811ad3e9b 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -1395,10 +1395,6 @@ setup_tx_desc_die: | |||
1395 | * (Descriptors) for all queues | 1395 | * (Descriptors) for all queues |
1396 | * @adapter: board private structure | 1396 | * @adapter: board private structure |
1397 | * | 1397 | * |
1398 | * If this function returns with an error, then it's possible one or | ||
1399 | * more of the rings is populated (while the rest are not). It is the | ||
1400 | * callers duty to clean those orphaned rings. | ||
1401 | * | ||
1402 | * Return 0 on success, negative on failure | 1398 | * Return 0 on success, negative on failure |
1403 | **/ | 1399 | **/ |
1404 | 1400 | ||
@@ -1412,6 +1408,9 @@ e1000_setup_all_tx_resources(struct e1000_adapter *adapter) | |||
1412 | if (err) { | 1408 | if (err) { |
1413 | DPRINTK(PROBE, ERR, | 1409 | DPRINTK(PROBE, ERR, |
1414 | "Allocation for Tx Queue %u failed\n", i); | 1410 | "Allocation for Tx Queue %u failed\n", i); |
1411 | for (i-- ; i >= 0; i--) | ||
1412 | e1000_free_tx_resources(adapter, | ||
1413 | &adapter->tx_ring[i]); | ||
1415 | break; | 1414 | break; |
1416 | } | 1415 | } |
1417 | } | 1416 | } |
@@ -1651,10 +1650,6 @@ setup_rx_desc_die: | |||
1651 | * (Descriptors) for all queues | 1650 | * (Descriptors) for all queues |
1652 | * @adapter: board private structure | 1651 | * @adapter: board private structure |
1653 | * | 1652 | * |
1654 | * If this function returns with an error, then it's possible one or | ||
1655 | * more of the rings is populated (while the rest are not). It is the | ||
1656 | * callers duty to clean those orphaned rings. | ||
1657 | * | ||
1658 | * Return 0 on success, negative on failure | 1653 | * Return 0 on success, negative on failure |
1659 | **/ | 1654 | **/ |
1660 | 1655 | ||
@@ -1668,6 +1663,9 @@ e1000_setup_all_rx_resources(struct e1000_adapter *adapter) | |||
1668 | if (err) { | 1663 | if (err) { |
1669 | DPRINTK(PROBE, ERR, | 1664 | DPRINTK(PROBE, ERR, |
1670 | "Allocation for Rx Queue %u failed\n", i); | 1665 | "Allocation for Rx Queue %u failed\n", i); |
1666 | for (i-- ; i >= 0; i--) | ||
1667 | e1000_free_rx_resources(adapter, | ||
1668 | &adapter->rx_ring[i]); | ||
1671 | break; | 1669 | break; |
1672 | } | 1670 | } |
1673 | } | 1671 | } |