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

Stephen Hemminger stephen at networkplumber.org
Sun Apr 5 18:11:31 CEST 2026


On Wed, 18 Feb 2026 08:41:00 -0800
Stephen Hemminger <stephen at 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 at 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.


More information about the dev mailing list