Commit ce89a39a authored by Florian Fainelli's avatar Florian Fainelli Committed by Kamal Mostafa

net: bgmac: Fix infinite loop in bgmac_dma_tx_add()

BugLink: http://bugs.launchpad.net/bugs/1614560

[ Upstream commit e86663c4 ]

Nothing is decrementing the index "i" while we are cleaning up the
fragments we could not successful transmit.

Fixes: 9cde9450 ("bgmac: implement scatter/gather support")
Reported-by: coverity (CID 1352048)
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent f0fed504
......@@ -219,7 +219,7 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment