Message ID | 20090523115143.GB1672@mail.wantstofly.org |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
On May 23, 2009, at 13:51, Lennert Buytenhek wrote: > Since commit 0fd56bb5be6455d0d42241e65aed057244665e5e ("gianfar: > Add support for skb recycling"), gianfar puts skbuffs that are in > the rx ring back onto the recycle list as-is in case there was a > receive error, but this breaks the following invariant: that all > skbuffs on the recycle list have skb->data = skb->head + NET_SKB_PAD. > > > Michael, can you re-test with this version of the patch? > Andy, can you see if this is OK with you? Hi, I have been running tests with this patch for the last 6 hours and had no panics so far. So it fixes the issues I am seeing as well. Hope this helps, Michael -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Michael Guntsche <mike@it-loops.com> Date: Sun, 24 May 2009 17:32:05 +0200 > > On May 23, 2009, at 13:51, Lennert Buytenhek wrote: > >> Since commit 0fd56bb5be6455d0d42241e65aed057244665e5e ("gianfar: >> Add support for skb recycling"), gianfar puts skbuffs that are in >> the rx ring back onto the recycle list as-is in case there was a >> receive error, but this breaks the following invariant: that all >> skbuffs on the recycle list have skb->data = skb->head + NET_SKB_PAD. >> >> >> Michael, can you re-test with this version of the patch? >> Andy, can you see if this is OK with you? > > Hi, I have been running tests with this patch for the last 6 hours and > had no panics so far. > So it fixes the issues I am seeing as well. Since it's now tested, I am applying this to net-2.6 to expedite it's inclusion into 2.6.30 Thanks. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index b2c4967..a051918 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -1885,8 +1885,17 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit) if (unlikely(!newskb)) newskb = skb; - else if (skb) + else if (skb) { + /* + * We need to reset ->data to what it + * was before gfar_new_skb() re-aligned + * it to an RXBUF_ALIGNMENT boundary + * before we put the skb back on the + * recycle list. + */ + skb->data = skb->head + NET_SKB_PAD; __skb_queue_head(&priv->rx_recycle, skb); + } } else { /* Increment the number of packets */ dev->stats.rx_packets++;
Since commit 0fd56bb5be6455d0d42241e65aed057244665e5e ("gianfar: Add support for skb recycling"), gianfar puts skbuffs that are in the rx ring back onto the recycle list as-is in case there was a receive error, but this breaks the following invariant: that all skbuffs on the recycle list have skb->data = skb->head + NET_SKB_PAD. The RXBUF_ALIGNMENT realignment done in gfar_new_skb() will be done twice on skbuffs recycled in this way, causing there not to be enough room in the skb anymore to receive a full packet, eventually leading to an skb_over_panic from gfar_clean_rx_ring() -> skb_put(). Resetting the skb->data pointer to skb->head + NET_SKB_PAD before putting the skb back onto the recycle list restores the mentioned invariant, and should fix this issue. Reported-by: Michael Guntsche <mike@it-loops.com> Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> --- This might/should/could fix http://bugzilla.kernel.org/show_bug.cgi?id=13293 Michael, can you re-test with this version of the patch? Andy, can you see if this is OK with you?