All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] bnx2: Fix bug in bnx2_free_tx_skbs().
@ 2012-07-10 20:04 Michael Chan
  2012-07-11  6:37 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Chan @ 2012-07-10 20:04 UTC (permalink / raw)
  To: davem; +Cc: netdev

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>
---
 drivers/net/ethernet/broadcom/bnx2.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
index ac7b744..1fa4927 100644
--- a/drivers/net/ethernet/broadcom/bnx2.c
+++ b/drivers/net/ethernet/broadcom/bnx2.c
@@ -5372,7 +5372,7 @@ bnx2_free_tx_skbs(struct bnx2 *bp)
 			int k, last;
 
 			if (skb == NULL) {
-				j++;
+				j = NEXT_TX_BD(j);
 				continue;
 			}
 
@@ -5384,8 +5384,8 @@ bnx2_free_tx_skbs(struct bnx2 *bp)
 			tx_buf->skb = NULL;
 
 			last = tx_buf->nr_frags;
-			j++;
-			for (k = 0; k < last; k++, j++) {
+			j = NEXT_TX_BD(j);
+			for (k = 0; k < last; k++, j = NEXT_TX_BD(j)) {
 				tx_buf = &txr->tx_buf_ring[TX_RING_IDX(j)];
 				dma_unmap_page(&bp->pdev->dev,
 					dma_unmap_addr(tx_buf, mapping),
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] bnx2: Fix bug in bnx2_free_tx_skbs().
  2012-07-10 20:04 [PATCH net] bnx2: Fix bug in bnx2_free_tx_skbs() Michael Chan
@ 2012-07-11  6:37 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-07-11  6:37 UTC (permalink / raw)
  To: mchan; +Cc: netdev

From: "Michael Chan" <mchan@broadcom.com>
Date: Tue, 10 Jul 2012 13:04:40 -0700

> 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>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-11  6:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-10 20:04 [PATCH net] bnx2: Fix bug in bnx2_free_tx_skbs() Michael Chan
2012-07-11  6:37 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.