diff options
-rw-r--r-- | net/core/skbuff.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c88426b51140..168e949df6a1 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2666,13 +2666,15 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) | |||
2666 | struct sk_buff *nskb; | 2666 | struct sk_buff *nskb; |
2667 | unsigned int headroom; | 2667 | unsigned int headroom; |
2668 | unsigned int len = skb_gro_len(skb); | 2668 | unsigned int len = skb_gro_len(skb); |
2669 | unsigned int offset = skb_gro_offset(skb); | ||
2670 | unsigned int headlen = skb_headlen(skb); | ||
2669 | 2671 | ||
2670 | if (p->len + len >= 65536) | 2672 | if (p->len + len >= 65536) |
2671 | return -E2BIG; | 2673 | return -E2BIG; |
2672 | 2674 | ||
2673 | if (skb_shinfo(p)->frag_list) | 2675 | if (skb_shinfo(p)->frag_list) |
2674 | goto merge; | 2676 | goto merge; |
2675 | else if (skb_headlen(skb) <= skb_gro_offset(skb)) { | 2677 | else if (headlen <= offset) { |
2676 | skb_frag_t *frag; | 2678 | skb_frag_t *frag; |
2677 | int i; | 2679 | int i; |
2678 | 2680 | ||
@@ -2680,10 +2682,8 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) | |||
2680 | MAX_SKB_FRAGS) | 2682 | MAX_SKB_FRAGS) |
2681 | return -E2BIG; | 2683 | return -E2BIG; |
2682 | 2684 | ||
2683 | skb_shinfo(skb)->frags[0].page_offset += | 2685 | skb_shinfo(skb)->frags[0].page_offset += offset - headlen; |
2684 | skb_gro_offset(skb) - skb_headlen(skb); | 2686 | skb_shinfo(skb)->frags[0].size -= offset - headlen; |
2685 | skb_shinfo(skb)->frags[0].size -= | ||
2686 | skb_gro_offset(skb) - skb_headlen(skb); | ||
2687 | 2687 | ||
2688 | frag = skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags; | 2688 | frag = skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags; |
2689 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) | 2689 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) |
@@ -2736,16 +2736,13 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) | |||
2736 | p = nskb; | 2736 | p = nskb; |
2737 | 2737 | ||
2738 | merge: | 2738 | merge: |
2739 | if (skb_gro_offset(skb) > skb_headlen(skb)) { | 2739 | if (offset > headlen) { |
2740 | skb_shinfo(skb)->frags[0].page_offset += | 2740 | skb_shinfo(skb)->frags[0].page_offset += offset - headlen; |
2741 | skb_gro_offset(skb) - skb_headlen(skb); | 2741 | skb_shinfo(skb)->frags[0].size -= offset - headlen; |
2742 | skb_shinfo(skb)->frags[0].size -= | 2742 | offset = headlen; |
2743 | skb_gro_offset(skb) - skb_headlen(skb); | ||
2744 | skb_gro_reset_offset(skb); | ||
2745 | skb_gro_pull(skb, skb_headlen(skb)); | ||
2746 | } | 2743 | } |
2747 | 2744 | ||
2748 | __skb_pull(skb, skb_gro_offset(skb)); | 2745 | __skb_pull(skb, offset); |
2749 | 2746 | ||
2750 | p->prev->next = skb; | 2747 | p->prev->next = skb; |
2751 | p->prev = skb; | 2748 | p->prev = skb; |