lkml.org 
[lkml]   [2002]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: BUG in 2.2.22 skb_realloc_headroom()
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/

\
 
 \ /
  Last update: 2005-03-22 13:30    [W:0.077 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site