]> git.karo-electronics.de Git - linux-beck.git/commitdiff
net: fec: ensure fec_enet_free_buffers() properly cleans the rings
authorRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 7 Jul 2014 23:23:25 +0000 (00:23 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Jul 2014 04:21:22 +0000 (21:21 -0700)
Ensure that we do not double-free any allocations, and that any transmit
skbuffs are properly freed when we clean up the rings.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c

index 9c5570a3e32e138309af82c85e5f88152c4ff044..5499bd8ad0a59f38fca4dfdb1dec33f76ba8ef4a 100644 (file)
@@ -2079,8 +2079,13 @@ static void fec_enet_free_buffers(struct net_device *ndev)
        }
 
        bdp = fep->tx_bd_base;
-       for (i = 0; i < fep->tx_ring_size; i++)
+       for (i = 0; i < fep->tx_ring_size; i++) {
                kfree(fep->tx_bounce[i]);
+               fep->tx_bounce[i] = NULL;
+               skb = fep->tx_skbuff[i];
+               fep->tx_skbuff[i] = NULL;
+               dev_kfree_skb(skb);
+       }
 }
 
 static int fec_enet_alloc_buffers(struct net_device *ndev)