mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Morris <jmorris@intercode.com.au>
To: "Nicolas S. Dade" <ndade@adsl-63-197-69-248.dsl.snfc21.pacbell.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: BUG in 2.2.22 skb_realloc_headroom()
Date: Wed, 30 Oct 2002 21:36:11 +1100 (EST)	[thread overview]
Message-ID: <Mutt.LNX.4.44.0210302117420.13753-100000@blackbird.intercode.com.au> (raw)
In-Reply-To: <20021029211945.A17657@ipx.esperanza>

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;
 



  reply	other threads:[~2002-10-30 10:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-30  5:19 Nicolas S. Dade
2002-10-30 10:36 ` James Morris [this message]
2002-10-30 10:51   ` Nicolas S. Dade

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Mutt.LNX.4.44.0210302117420.13753-100000@blackbird.intercode.com.au \
    --to=jmorris@intercode.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ndade@adsl-63-197-69-248.dsl.snfc21.pacbell.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®