Re: BUG in 2.2.22 skb_realloc_headroom()

From: James Morris (jmorris@intercode.com.au)
Date: Wed Oct 30 2002 - 05:36:11 EST


On Tue, 29 Oct 2002, Nicolas S. Dade wrote:

> skb_realloc_headroom() panics when new headroom is smaller
> than existing headroom.

Would you please test out the patch below?

Thanks,

- James

-- 
James Morris
<jmorris@intercode.com.au>

diff -urN -X dontdiff linux-2.2.22.orig/net/core/skbuff.c linux-2.2.22.skbrealloc/net/core/skbuff.c --- linux-2.2.22.orig/net/core/skbuff.c Wed Sep 25 00:06:26 2002 +++ linux-2.2.22.skbrealloc/net/core/skbuff.c Wed Oct 30 21:25:02 2002 @@ -316,13 +316,16 @@ { struct sk_buff *n; unsigned long offset; - int headroom = skb_headroom(skb); + int delta = newheadroom - skb_headroom(skb); + + if (delta <= 0) + delta = 0; /* * Allocate the copy buffer */ - n=alloc_skb(skb->truesize+newheadroom-headroom, GFP_ATOMIC); + n=alloc_skb(skb->truesize + delta, GFP_ATOMIC); if(n==NULL) return NULL;

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Oct 31 2002 - 22:00:46 EST