Skip to content

Commit

Permalink
l2tp: fix a potential skb leak in l2tp_xmit_skb()
Browse files Browse the repository at this point in the history
l2tp_xmit_skb() can leak one skb if skb_cow_head() returns an error.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Oct 19, 2011
1 parent 1ce5cce commit 835acf5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/l2tp/l2tp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,8 +1045,10 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len
headroom = NET_SKB_PAD + sizeof(struct iphdr) +
uhlen + hdr_len;
old_headroom = skb_headroom(skb);
if (skb_cow_head(skb, headroom))
if (skb_cow_head(skb, headroom)) {
dev_kfree_skb(skb);
goto abort;
}

new_headroom = skb_headroom(skb);
skb_orphan(skb);
Expand Down

0 comments on commit 835acf5

Please sign in to comment.