Commit 835acf5da239b91edb9f7ebe36516999e156e6ee
Committed by
David S. Miller
1 parent
1ce5cce895
Exists in
master
and in
6 other branches
l2tp: fix a potential skb leak in l2tp_xmit_skb()
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>
Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff
net/l2tp/l2tp_core.c
... | ... | @@ -1045,8 +1045,10 @@ |
1045 | 1045 | headroom = NET_SKB_PAD + sizeof(struct iphdr) + |
1046 | 1046 | uhlen + hdr_len; |
1047 | 1047 | old_headroom = skb_headroom(skb); |
1048 | - if (skb_cow_head(skb, headroom)) | |
1048 | + if (skb_cow_head(skb, headroom)) { | |
1049 | + dev_kfree_skb(skb); | |
1049 | 1050 | goto abort; |
1051 | + } | |
1050 | 1052 | |
1051 | 1053 | new_headroom = skb_headroom(skb); |
1052 | 1054 | skb_orphan(skb); |