Skip to content

Commit

Permalink
[XFRM]: skb_cow_data() does not set proper owner for new skbs.
Browse files Browse the repository at this point in the history
It looks like skb_cow_data() does not set 
proper owner for newly created skb.

If we have several fragments for skb and some of them
are shared(?) or cloned (like in async IPsec) there 
might be a situation when we require recreating skb and 
thus using skb_copy() for it.
Newly created skb has neither a destructor nor a socket
assotiated with it, which must be copied from the old skb.
As far as I can see, current code sets destructor and socket
for the first one skb only and uses truesize of the first skb
only to increment sk_wmem_alloc value.

If above "analysis" is correct then attached patch fixes that.

Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Evgeniy Polyakov authored and David S. Miller committed May 19, 2005
1 parent f7383c2 commit d481020
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/xfrm/xfrm_algo.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer)
return -ENOMEM;

if (skb1->sk)
skb_set_owner_w(skb, skb1->sk);
skb_set_owner_w(skb2, skb1->sk);

/* Looking around. Are we still alive?
* OK, link new skb, drop old one */
Expand Down

0 comments on commit d481020

Please sign in to comment.