]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
igbvf: Fix leak in TX DMA error cleanup
authorMatt Vollrath <tactii@gmail.com>
Fri, 17 Apr 2026 03:34:52 +0000 (23:34 -0400)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 28 Jul 2026 18:23:01 +0000 (11:23 -0700)
If an error is encountered while mapping TX buffers, the driver should
unmap any buffers already mapped for that skb.

Because count is incremented before each frag mapping, it will always
match the correct number of unmappings needed when dma_error is reached.
Decrementing count before the while loop in dma_error causes an
off-by-one error. If any mapping was successful before an unsuccessful
mapping, exactly one DMA mapping (the head) would leak.

This bug was introduced by a 2010 fix for an endless loop in dma_error.
All other affected drivers have already been fixed.

Fixes: c1fa347f20f1 ("e1000/e1000e/igb/igbvf/ixgb/ixgbe: Fix tests of unsigned in *_tx_map()")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-4-7-opus
Signed-off-by: Matt Vollrath <tactii@gmail.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/igbvf/netdev.c

index 0a3d0a1cba433cc384fa934f9c6d1cbe453cef87..c686ee120a143f9a6a8a188ff15f26473df08c38 100644 (file)
@@ -2190,8 +2190,6 @@ dma_error:
        buffer_info->time_stamp = 0;
        buffer_info->length = 0;
        buffer_info->mapped_as_page = false;
-       if (count)
-               count--;
 
        /* clear timestamp and dma mappings for remaining portion of packet */
        while (count--) {