net: fix setting of skb->tail in skb_recycle_check()
authorLennert Buytenhek <buytenh@marvell.com>
Tue, 11 Nov 2008 05:45:05 +0000 (21:45 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Nov 2008 05:45:05 +0000 (21:45 -0800)
Since skb_reset_tail_pointer() reads skb->data, we need to set
skb->data before calling skb_reset_tail_pointer().  This was causing
spurious skb_over_panic()s from skb_put() being called on a recycled
skb that had its skb->tail set to beyond where it should have been.

Bug report from Peter van Valderen <linux@ddcrew.com>.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/skbuff.c

index ebb6b94f8af2343963f10c02b2d35f912a8c9d46..d49ef8301b5bd5de20d1b8a6e57aa5144ffff28a 100644 (file)
@@ -486,8 +486,8 @@ int skb_recycle_check(struct sk_buff *skb, int skb_size)
        shinfo->frag_list = NULL;
 
        memset(skb, 0, offsetof(struct sk_buff, tail));
-       skb_reset_tail_pointer(skb);
        skb->data = skb->head + NET_SKB_PAD;
+       skb_reset_tail_pointer(skb);
 
        return 1;
 }