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.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index fb3770f9c094..bb7210f4005e 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -464,7 +464,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
464 n->tc_verd = CLR_TC_MUNGED(n->tc_verd); 464 n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
465 C(input_dev); 465 C(input_dev);
466#endif 466#endif
467 467 skb_copy_secmark(n, skb);
468#endif 468#endif
469 C(truesize); 469 C(truesize);
470 atomic_set(&n->users, 1); 470 atomic_set(&n->users, 1);
@@ -526,6 +526,7 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
526#endif 526#endif
527 new->tc_index = old->tc_index; 527 new->tc_index = old->tc_index;
528#endif 528#endif
529 skb_copy_secmark(new, old);
529 atomic_set(&new->users, 1); 530 atomic_set(&new->users, 1);
530 skb_shinfo(new)->tso_size = skb_shinfo(old)->tso_size; 531 skb_shinfo(new)->tso_size = skb_shinfo(old)->tso_size;
531 skb_shinfo(new)->tso_segs = skb_shinfo(old)->tso_segs; 532 skb_shinfo(new)->tso_segs = skb_shinfo(old)->tso_segs;
@@ -800,12 +801,10 @@ struct sk_buff *skb_pad(struct sk_buff *skb, int pad)
800 return nskb; 801 return nskb;
801} 802}
802 803
803/* Trims skb to length len. It can change skb pointers, if "realloc" is 1. 804/* Trims skb to length len. It can change skb pointers.
804 * If realloc==0 and trimming is impossible without change of data,
805 * it is BUG().
806 */ 805 */
807 806
808int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc) 807int ___pskb_trim(struct sk_buff *skb, unsigned int len)
809{ 808{
810 int offset = skb_headlen(skb); 809 int offset = skb_headlen(skb);
811 int nfrags = skb_shinfo(skb)->nr_frags; 810 int nfrags = skb_shinfo(skb)->nr_frags;
@@ -815,7 +814,6 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc)
815 int end = offset + skb_shinfo(skb)->frags[i].size; 814 int end = offset + skb_shinfo(skb)->frags[i].size;
816 if (end > len) { 815 if (end > len) {
817 if (skb_cloned(skb)) { 816 if (skb_cloned(skb)) {
818 BUG_ON(!realloc);
819 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) 817 if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
820 return -ENOMEM; 818 return -ENOMEM;
821 } 819 }