Skip to content

Commit

Permalink
dst: Clone child entry in skb_dst_pop
Browse files Browse the repository at this point in the history
We clone the child entry in skb_dst_pop before we call
skb_dst_drop(). Otherwise we might kill the child right
before we return it to the caller.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Steffen Klassert authored and David S. Miller committed Mar 28, 2011
1 parent 3bc0732 commit e433430
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/net/dst.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev)

static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
{
struct dst_entry *child = skb_dst(skb)->child;
struct dst_entry *child = dst_clone(skb_dst(skb)->child);

skb_dst_drop(skb);
return child;
Expand Down
2 changes: 1 addition & 1 deletion net/xfrm/xfrm_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
err = -EHOSTUNREACH;
goto error_nolock;
}
skb_dst_set(skb, dst_clone(dst));
skb_dst_set(skb, dst);
x = dst->xfrm;
} while (x && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL));

Expand Down

0 comments on commit e433430

Please sign in to comment.