aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/skbuff.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/skbuff.c')
-rw-r--r--net/core/skbuff.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 57555a4525da..e03d77d4c1c9 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2018,7 +2018,10 @@ void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len)
2018 skb_split_no_header(skb, skb1, len, pos); 2018 skb_split_no_header(skb, skb1, len, pos);
2019} 2019}
2020 2020
2021/* Shifting from/to a cloned skb is a no-go. */ 2021/* Shifting from/to a cloned skb is a no-go.
2022 *
2023 * Caller cannot keep skb_shinfo related pointers past calling here!
2024 */
2022static int skb_prepare_for_shift(struct sk_buff *skb) 2025static int skb_prepare_for_shift(struct sk_buff *skb)
2023{ 2026{
2024 return skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC); 2027 return skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
@@ -2070,6 +2073,8 @@ int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen)
2070 skb_prepare_for_shift(tgt)) 2073 skb_prepare_for_shift(tgt))
2071 return 0; 2074 return 0;
2072 2075
2076 /* All previous frag pointers might be stale! */
2077 fragfrom = &skb_shinfo(skb)->frags[from];
2073 fragto = &skb_shinfo(tgt)->frags[merge]; 2078 fragto = &skb_shinfo(tgt)->frags[merge];
2074 2079
2075 fragto->size += shiftlen; 2080 fragto->size += shiftlen;