Commit cd0ea241 authored by Jarek Poplawski's avatar Jarek Poplawski Committed by David S. Miller

gianfar: Fix crashes on RX path (Was Re: [Bugme-new] [Bug 19692] New:...

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: 0fd56bb5 ("gianfar: Add
support for skb recycling")
Reported-by: default avataremin ak <eminak71@gmail.com>
Tested-by: default avataremin ak <eminak71@gmail.com>
Signed-off-by: default avatarJarek Poplawski <jarkao2@gmail.com>
CC: Andy Fleming <afleming@freescale.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7a876b0e
...@@ -2511,7 +2511,7 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue) ...@@ -2511,7 +2511,7 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
skb_recycle_check(skb, priv->rx_buffer_size + skb_recycle_check(skb, priv->rx_buffer_size +
RXBUF_ALIGNMENT)) { RXBUF_ALIGNMENT)) {
gfar_align_skb(skb); gfar_align_skb(skb);
__skb_queue_head(&priv->rx_recycle, skb); skb_queue_head(&priv->rx_recycle, skb);
} else } else
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
...@@ -2594,7 +2594,7 @@ struct sk_buff * gfar_new_skb(struct net_device *dev) ...@@ -2594,7 +2594,7 @@ struct sk_buff * gfar_new_skb(struct net_device *dev)
struct gfar_private *priv = netdev_priv(dev); struct gfar_private *priv = netdev_priv(dev);
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
skb = __skb_dequeue(&priv->rx_recycle); skb = skb_dequeue(&priv->rx_recycle);
if (!skb) if (!skb)
skb = gfar_alloc_skb(dev); skb = gfar_alloc_skb(dev);
...@@ -2750,7 +2750,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit) ...@@ -2750,7 +2750,7 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
if (unlikely(!newskb)) if (unlikely(!newskb))
newskb = skb; newskb = skb;
else if (skb) else if (skb)
__skb_queue_head(&priv->rx_recycle, skb); skb_queue_head(&priv->rx_recycle, skb);
} else { } else {
/* Increment the number of packets */ /* Increment the number of packets */
rx_queue->stats.rx_packets++; rx_queue->stats.rx_packets++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment