Re: [PATCH 2/4] net/axgbe: fix Rx queue leak on descriptor init failure

Stephen Hemminger
2026-04-05T16:11:45Z

On Wed, 18 Feb 2026 08:41:00 -0800
Stephen Hemminger <stephen@networkplumber.org> wrote:

> When wrapper_rx_desc_init() fails to allocate an mbuf for queue i,
> only queue i is released. Queues 0 through i-1 have already been
> fully populated with mbufs assigned to sw_ring entries and
> programmed into hardware descriptors, but are never cleaned up.
> This leaks all mbufs from the previously initialized queues.
>
> Fix by releasing all previously initialized queues when an
> allocation failure occurs.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---

AI found off by one in its own patch...

Patch 2 has an off-by-one in the cleanup loop.
The do-while releases queue i first (the failing queue), then loops while i-- > 0.
Since 0 > 0 is false, queue 0 is never released — its mbufs leak.
Should use i-- != 0 or a forward for-loop through 0..i.