Skip to content

Commit

Permalink
net: bgmac: Fix infinite loop in bgmac_dma_tx_add()
Browse files Browse the repository at this point in the history
BugLink: http://bugs.launchpad.net/bugs/1614560

[ Upstream commit e86663c ]

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

Fixes: 9cde945 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
  • Loading branch information
ffainelli authored and kamalmostafa committed Aug 18, 2016
1 parent f0fed50 commit ce89a39
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/bgmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ce89a39

Please sign in to comment.