aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-04-10 21:30:09 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:28:53 -0400
commitefd1e8d569b3d35a3a636683c2a9ebffec9c1fcf (patch)
treef4f91e9ec30fe4cdf4a3dd36a453b2ee28e217dc /net/core
parent33036807b32d5ed1f4fdfe2d5e6bab2bb260b9f7 (diff)
[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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/skbuff.c11
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