net: bgmac: Fix infinite loop in bgmac_dma_tx_add()
authorFlorian Fainelli <f.fainelli@gmail.com>
Fri, 15 Jul 2016 22:42:52 +0000 (15:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Jul 2016 23:03:47 +0000 (16:03 -0700)
Nothing is decrementing the index "i" while we are cleaning up the
fragments we could not successful transmit.

Fixes: 9cde94506eacf ("bgmac: implement scatter/gather support")
Reported-by: coverity (CID 1352048)
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bgmac.c

index a6333d38ecc02be43614e02d69da3910127b0e9f..25bbae5928d43a4d911d0d5852612d8524437cdb 100644 (file)
@@ -231,7 +231,7 @@ err_dma:
        dma_unmap_single(dma_dev, slot->dma_addr, skb_headlen(skb),
                         DMA_TO_DEVICE);
 
-       while (i > 0) {
+       while (i-- > 0) {
                int index = (ring->end + i) % BGMAC_TX_RING_SLOTS;
                struct bgmac_slot_info *slot = &ring->slots[index];
                u32 ctl1 = le32_to_cpu(ring->cpu_base[index].ctl1);