Commit efd1e8d5 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[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: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 33036807
...@@ -736,7 +736,9 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, ...@@ -736,7 +736,9 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
*/ */
struct sk_buff *n = alloc_skb(newheadroom + skb->len + newtailroom, struct sk_buff *n = alloc_skb(newheadroom + skb->len + newtailroom,
gfp_mask); gfp_mask);
int oldheadroom = skb_headroom(skb);
int head_copy_len, head_copy_off; int head_copy_len, head_copy_off;
int off = 0;
if (!n) if (!n)
return NULL; return NULL;
...@@ -746,7 +748,7 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, ...@@ -746,7 +748,7 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
/* Set the tail pointer and length */ /* Set the tail pointer and length */
skb_put(n, skb->len); skb_put(n, skb->len);
head_copy_len = skb_headroom(skb); head_copy_len = oldheadroom;
head_copy_off = 0; head_copy_off = 0;
if (newheadroom <= head_copy_len) if (newheadroom <= head_copy_len)
head_copy_len = newheadroom; head_copy_len = newheadroom;
...@@ -760,6 +762,13 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, ...@@ -760,6 +762,13 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
copy_skb_header(n, 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; return n;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment