mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 08:08:54 +00:00
net: fix skb leak in __skb_tstamp_tx()
commit8a02fb71d7
upstream. Commit50749f2dd6
("tcp/udp: Fix memleaks of sk and zerocopy skbs with TX timestamp.") added a call to skb_orphan_frags_rx() to fix leaks with zerocopy skbs. But it ended up adding a leak of its own. When skb_orphan_frags_rx() fails, the function just returns, leaking the skb it just cloned. Free it before returning. This bug was discovered and resolved using Coverity Static Analysis Security Testing (SAST) by Synopsys, Inc. Fixes:50749f2dd6
("tcp/udp: Fix memleaks of sk and zerocopy skbs with TX timestamp.") Signed-off-by: Pratyush Yadav <ptyadav@amazon.de> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://lore.kernel.org/r/20230522153020.32422-1-ptyadav@amazon.de Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8f1512d78b
commit
e06841a2ab
1 changed files with 3 additions and 1 deletions
|
@ -4961,8 +4961,10 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb,
|
|||
} else {
|
||||
skb = skb_clone(orig_skb, GFP_ATOMIC);
|
||||
|
||||
if (skb_orphan_frags_rx(skb, GFP_ATOMIC))
|
||||
if (skb_orphan_frags_rx(skb, GFP_ATOMIC)) {
|
||||
kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!skb)
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue