Răsfoiți Sursa

[PATCH] mv643xx: fix skb memory leak

This patch fixes an skb memory leak under heavy receive load
(whenever the more packets have been received than the NAPI budget
allows to be processed).

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Dale Farnsworth 20 ani în urmă
părinte
comite
b1dd9ca177
1 a modificat fișierele cu 2 adăugiri și 4 ștergeri
  1. 2 4
      drivers/net/mv643xx_eth.c

+ 2 - 4
drivers/net/mv643xx_eth.c

@@ -412,15 +412,13 @@ static int mv643xx_eth_receive_queue(struct net_device *dev)
 	struct pkt_info pkt_info;
 	struct pkt_info pkt_info;
 
 
 #ifdef MV643XX_NAPI
 #ifdef MV643XX_NAPI
-	while (eth_port_receive(mp, &pkt_info) == ETH_OK && budget > 0) {
+	while (budget-- > 0 && eth_port_receive(mp, &pkt_info) == ETH_OK) {
 #else
 #else
 	while (eth_port_receive(mp, &pkt_info) == ETH_OK) {
 	while (eth_port_receive(mp, &pkt_info) == ETH_OK) {
 #endif
 #endif
 		mp->rx_ring_skbs--;
 		mp->rx_ring_skbs--;
 		received_packets++;
 		received_packets++;
-#ifdef MV643XX_NAPI
-		budget--;
-#endif
+
 		/* Update statistics. Note byte count includes 4 byte CRC count */
 		/* Update statistics. Note byte count includes 4 byte CRC count */
 		stats->rx_packets++;
 		stats->rx_packets++;
 		stats->rx_bytes += pkt_info.byte_cnt;
 		stats->rx_bytes += pkt_info.byte_cnt;