Commit f083fae2 authored by David S. Miller's avatar David S. Miller

[NET]: Make skb_copy_expand() copy header area too.

parent cd520eba
...@@ -583,6 +583,8 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, ...@@ -583,6 +583,8 @@ 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 head_copy_len, head_copy_off;
if (!n) if (!n)
return NULL; return NULL;
...@@ -591,8 +593,16 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, ...@@ -591,8 +593,16 @@ 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);
/* Copy the data only. */ head_copy_len = skb_headroom(skb);
if (skb_copy_bits(skb, 0, n->data, skb->len)) head_copy_off = 0;
if (newheadroom < head_copy_len) {
head_copy_off = head_copy_len - newheadroom;
head_copy_len = newheadroom;
}
/* Copy the linear header and data. */
if (skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
skb->len + head_copy_len))
BUG(); BUG();
copy_skb_header(n, skb); copy_skb_header(n, skb);
......
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