Re: [PATCH net] net: fix skb leak in __skb_tstamp_tx()

From: Willem de Bruijn
Date: Mon May 22 2023 - 12:12:10 EST


On Mon, May 22, 2023 at 11:46 AM Kuniyuki Iwashima <kuniyu@xxxxxxxxxx> wrote:
>
> From: Pratyush Yadav <ptyadav@xxxxxxxxx>
> Date: Mon, 22 May 2023 17:30:20 +0200
> > Commit 50749f2dd685 ("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: 50749f2dd685 ("tcp/udp: Fix memleaks of sk and zerocopy skbs with TX timestamp.")
> > Signed-off-by: Pratyush Yadav <ptyadav@xxxxxxxxx>
>
> Reviewed-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>

Reviewed-by: Willem de Bruijn <willemb@xxxxxxxxxx>