aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2012-07-10 06:04:40 -0400
committerLuis Henriques <luis.henriques@canonical.com>2012-08-13 09:10:37 -0400
commitf0cf58569d6e24162bd31e28080df53ad6da8b6d (patch)
tree4d2845d739d6c7111e757142ecfb7bc8d6b50096
parent856a273f5f38dc0ff79f0e1acea579c879c57a14 (diff)
bnx2: Fix bug in bnx2_free_tx_skbs().
BugLink: http://bugs.launchpad.net/bugs/1034988 [ Upstream commit c1f5163de417dab01fa9daaf09a74bbb19303f3c ] In rare cases, bnx2x_free_tx_skbs() can unmap the wrong DMA address when it gets to the last entry of the tx ring. We were not using the proper macro to skip the last entry when advancing the tx index. Reported-by: Zongyun Lai <zlai@vmware.com> Reviewed-by: Jeffrey Huang <huangjw@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
-rw-r--r--drivers/net/bnx2.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 74580bb175f..c9b123c1608 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -5310,7 +5310,7 @@ bnx2_free_tx_skbs(struct bnx2 *bp)
5310 int k, last; 5310 int k, last;
5311 5311
5312 if (skb == NULL) { 5312 if (skb == NULL) {
5313 j++; 5313 j = NEXT_TX_BD(j);
5314 continue; 5314 continue;
5315 } 5315 }
5316 5316
@@ -5322,8 +5322,8 @@ bnx2_free_tx_skbs(struct bnx2 *bp)
5322 tx_buf->skb = NULL; 5322 tx_buf->skb = NULL;
5323 5323
5324 last = tx_buf->nr_frags; 5324 last = tx_buf->nr_frags;
5325 j++; 5325 j = NEXT_TX_BD(j);
5326 for (k = 0; k < last; k++, j++) { 5326 for (k = 0; k < last; k++, j = NEXT_TX_BD(j)) {
5327 tx_buf = &txr->tx_buf_ring[TX_RING_IDX(j)]; 5327 tx_buf = &txr->tx_buf_ring[TX_RING_IDX(j)];
5328 dma_unmap_page(&bp->pdev->dev, 5328 dma_unmap_page(&bp->pdev->dev,
5329 dma_unmap_addr(tx_buf, mapping), 5329 dma_unmap_addr(tx_buf, mapping),