From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Kernel Netdev Mailing List <netdev@vger.kernel.org>
Subject: Re: [SK_BUFF]: Fix missing offset adjustment in skb_copy_expand
Date: Wed, 11 Apr 2007 02:42:59 +0200 [thread overview]
Message-ID: <461C2F13.1080808@trash.net> (raw)
In-Reply-To: <461849C5.8000507@trash.net>
[-- Attachment #1: Type: text/plain, Size: 310 bytes --]
Hi Dave,
Patrick McHardy wrote:
> [SK_BUFF]: Fix missing offset adjustment in skb_copy_expand
>
> skb_copy_expand changes the headroom, so it needs to adjust the header
> offsets by the difference between the old and the new value.
it seems like you missed this one. Attached again for your convenience.
[-- Attachment #2: 02.diff --]
[-- Type: text/x-diff, Size: 1671 bytes --]
[SK_BUFF]: Fix missing offset adjustment in skb_copy_expand
skb_copy_expand changes the headroom, so it needs to adjust the header
offsets by the difference between the old and the new value.
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 9cb76fae709a9303777286998baa457b0730a225
tree 2ea619c7daf9c5e6829dad6d502386eb9c922700
parent fb98b03719ad23840ca005edbba3c86ef1e3282c
author Patrick McHardy <kaber@trash.net> Sun, 08 Apr 2007 03:36:49 +0200
committer Patrick McHardy <kaber@trash.net> Sun, 08 Apr 2007 03:36:49 +0200
net/core/skbuff.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 5c9ee94..f2cffd4 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -794,7 +794,9 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
*/
struct sk_buff *n = alloc_skb(newheadroom + skb->len + newtailroom,
gfp_mask);
+ int oldheadroom = skb_headroom(skb);
int head_copy_len, head_copy_off;
+ int off = 0;
if (!n)
return NULL;
@@ -804,7 +806,7 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
/* Set the tail pointer and length */
skb_put(n, skb->len);
- head_copy_len = skb_headroom(skb);
+ head_copy_len = oldheadroom;
head_copy_off = 0;
if (newheadroom <= head_copy_len)
head_copy_len = newheadroom;
@@ -818,6 +820,13 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
copy_skb_header(n, skb);
+#ifdef NET_SKBUFF_DATA_USES_OFFSET
+ off = newheadroom - oldheadroom;
+#endif
+ n->transport_header += off;
+ n->network_header += off;
+ n->mac_header += off;
+
return n;
}
next prev parent reply other threads:[~2007-04-11 0:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-08 1:47 [SK_BUFF]: Fix missing offset adjustment in skb_copy_expand Patrick McHardy
2007-04-11 0:42 ` Patrick McHardy [this message]
2007-04-11 1:31 ` David Miller
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=461C2F13.1080808@trash.net \
--to=kaber@trash.net \
--cc=acme@ghostprotocols.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).