diff options
Diffstat (limited to 'net/core')
-rw-r--r-- | 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 52a4fdd4f31c..c7a1b24b7374 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -736,7 +736,9 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, | |||
736 | */ | 736 | */ |
737 | struct sk_buff *n = alloc_skb(newheadroom + skb->len + newtailroom, | 737 | struct sk_buff *n = alloc_skb(newheadroom + skb->len + newtailroom, |
738 | gfp_mask); | 738 | gfp_mask); |
739 | int oldheadroom = skb_headroom(skb); | ||
739 | int head_copy_len, head_copy_off; | 740 | int head_copy_len, head_copy_off; |
741 | int off = 0; | ||
740 | 742 | ||
741 | if (!n) | 743 | if (!n) |
742 | return NULL; | 744 | return NULL; |
@@ -746,7 +748,7 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, | |||
746 | /* Set the tail pointer and length */ | 748 | /* Set the tail pointer and length */ |
747 | skb_put(n, skb->len); | 749 | skb_put(n, skb->len); |
748 | 750 | ||
749 | head_copy_len = skb_headroom(skb); | 751 | head_copy_len = oldheadroom; |
750 | head_copy_off = 0; | 752 | head_copy_off = 0; |
751 | if (newheadroom <= head_copy_len) | 753 | if (newheadroom <= head_copy_len) |
752 | head_copy_len = newheadroom; | 754 | head_copy_len = newheadroom; |
@@ -760,6 +762,13 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb, | |||
760 | 762 | ||
761 | copy_skb_header(n, skb); | 763 | copy_skb_header(n, skb); |
762 | 764 | ||
765 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | ||
766 | off = newheadroom - oldheadroom; | ||
767 | #endif | ||
768 | n->transport_header += off; | ||
769 | n->network_header += off; | ||
770 | n->mac_header += off; | ||
771 | |||
763 | return n; | 772 | return n; |
764 | } | 773 | } |
765 | 774 | ||