Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bnx2: Fix bug in bnx2_free_tx_skbs().

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>

authored by

Michael Chan and committed by
David S. Miller
c1f5163d b28ba726

+3 -3
+3 -3
drivers/net/ethernet/broadcom/bnx2.c
··· 5372 5372 int k, last; 5373 5373 5374 5374 if (skb == NULL) { 5375 - j++; 5375 + j = NEXT_TX_BD(j); 5376 5376 continue; 5377 5377 } 5378 5378 ··· 5384 5384 tx_buf->skb = NULL; 5385 5385 5386 5386 last = tx_buf->nr_frags; 5387 - j++; 5388 - for (k = 0; k < last; k++, j++) { 5387 + j = NEXT_TX_BD(j); 5388 + for (k = 0; k < last; k++, j = NEXT_TX_BD(j)) { 5389 5389 tx_buf = &txr->tx_buf_ring[TX_RING_IDX(j)]; 5390 5390 dma_unmap_page(&bp->pdev->dev, 5391 5391 dma_unmap_addr(tx_buf, mapping),