aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar.c
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@gmail.com>2010-10-18 20:06:36 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-27 14:37:28 -0400
commitcd0ea2419544cfc4ccbf8ee0087d0d9f109852d2 (patch)
tree13f9f62dd9583170d1b93259b7ee1393ad9bc9ba /drivers/net/gianfar.c
parent7a876b0efcba3804da3051313445fa7be751cab7 (diff)
gianfar: Fix crashes on RX path (Was Re: [Bugme-new] [Bug 19692] New: linux-2.6.36-rc5 crash with gianfar ethernet at full line rate traffic)
The rx_recycle queue is global per device but can be accesed by many napi handlers at the same time, so it needs full skb_queue primitives (with locking). Otherwise, various crashes caused by broken skbs are possible. This patch resolves, at least partly, bugzilla bug 19692. (Because of some doubts that there could be still something around which is hard to reproduce my proposal is to leave this bug opened for a month.) Fixes commit: 0fd56bb5be6455d0d42241e65aed057244665e5e ("gianfar: Add support for skb recycling") Reported-by: emin ak <eminak71@gmail.com> Tested-by: emin ak <eminak71@gmail.com> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com> CC: Andy Fleming <afleming@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r--drivers/net/gianfar.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 4c4cc80ec0a1..49e4ce1246a7 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -2511,7 +2511,7 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
2511 skb_recycle_check(skb, priv->rx_buffer_size + 2511 skb_recycle_check(skb, priv->rx_buffer_size +
2512 RXBUF_ALIGNMENT)) { 2512 RXBUF_ALIGNMENT)) {
2513 gfar_align_skb(skb); 2513 gfar_align_skb(skb);
2514 __skb_queue_head(&priv->rx_recycle, skb); 2514 skb_queue_head(&priv->rx_recycle, skb);
2515 } else 2515 } else
2516 dev_kfree_skb_any(skb); 2516 dev_kfree_skb_any(skb);
2517 2517
@@ -2594,7 +2594,7 @@ struct sk_buff * gfar_new_skb(struct net_device *dev)
2594 struct gfar_private *priv = netdev_priv(dev); 2594 struct gfar_private *priv = netdev_priv(dev);
2595 struct sk_buff *skb = NULL; 2595 struct sk_buff *skb = NULL;
2596 2596
2597 skb = __skb_dequeue(&priv->rx_recycle); 2597 skb = skb_dequeue(&priv->rx_recycle);
2598 if (!skb) 2598 if (!skb)
2599 skb = gfar_alloc_skb(dev); 2599 skb = gfar_alloc_skb(dev);
2600 2600
@@ -2750,7 +2750,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
2750 if (unlikely(!newskb)) 2750 if (unlikely(!newskb))
2751 newskb = skb; 2751 newskb = skb;
2752 else if (skb) 2752 else if (skb)
2753 __skb_queue_head(&priv->rx_recycle, skb); 2753 skb_queue_head(&priv->rx_recycle, skb);
2754 } else { 2754 } else {
2755 /* Increment the number of packets */ 2755 /* Increment the number of packets */
2756 rx_queue->stats.rx_packets++; 2756 rx_queue->stats.rx_packets++;