summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Fleming2008-12-18 01:50:22 +0100
committerDavid S. Miller2008-12-18 01:50:22 +0100
commit8882d9a60028a9937e9c5652cfb80d4399ce5242 (patch)
treed39f493014cc3c3959617ef78d003a72668c5cbe
parentdccp_diag: LISTEN sockets don't have CCIDs (diff)
downloadkernel-qcow2-linux-8882d9a60028a9937e9c5652cfb80d4399ce5242.tar.gz
kernel-qcow2-linux-8882d9a60028a9937e9c5652cfb80d4399ce5242.tar.xz
kernel-qcow2-linux-8882d9a60028a9937e9c5652cfb80d4399ce5242.zip
gianfar: Fix packet drop when out of memory
The patch which fixed gianfar so it drops packets when it runs out of memory left in the code which frees the skb when it drops packets. Change the code so that we only free the skb if the new skb was successfully created. Signed-off-by: Andy Fleming <afleming@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/gianfar.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 3e611a69df13..a6efabc28dc8 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1732,8 +1732,7 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
if (unlikely(!newskb))
newskb = skb;
-
- if (skb)
+ else if (skb)
dev_kfree_skb_any(skb);
} else {
/* Increment the number of packets */