Re: [PATCH net] sfc: fix potential memleak in __ef100_hard_start_xmit()
From: Paolo Abeni
Date: Tue Nov 22 2022 - 03:30:44 EST
Hello,
On Fri, 2022-11-18 at 19:11 +0200, Leon Romanovsky wrote:
> On Fri, Nov 18, 2022 at 09:15:43AM +0000, Martin Habets wrote:
> > On Thu, Nov 17, 2022 at 03:05:27PM +0200, Leon Romanovsky wrote:
> > > Please take a look __ef100_enqueue_skb() and see if it frees SKB on
> > > error or not. If not, please fix it.
> >
> > That function looks ok to me, but I appreciate the extra eyes on it.
>
> __ef100_enqueue_skb() has the following check in error path:
>
> 498 err:
> 499 efx_enqueue_unwind(tx_queue, old_insert_count);
> 500 if (!IS_ERR_OR_NULL(skb))
> 501 dev_kfree_skb_any(skb);
> 502
>
> The issue is that skb is never error or null here and this "if" is
> actually always true and can be deleted.
I think that such additional change could be suite for a different net-
next patch, while this -net patch could land as is, @Leon: do you
agree?
Thanks!
Paolo