Skip to contentSkip to conversation

igbvf: fix DMA mapping leak in TX error path

PATCH New David Carlier 1 participant 1 message Mar 24

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igbvf: fix DMA mapping leak in TX error path

When a DMA mapping error occurs in igbvf_tx_map_adv(), the error cleanup code decrements count before the unmap loop, causing exactly one successfully mapped DMA buffer to be leaked.

This is the same off-by-one bug that was fixed in e1000/e1000e by commit e94eaef11142 ("e1000/e1000e: Fix leak in DMA error cleanup"), which noted: "This issue may still exist in the igbvf driver."

Remove the erroneous decrement so the while loop correctly unmaps all successfully mapped buffers.

Fixes c1fa347f20f1 ("e1000/e1000e/igb/igbvf/ixgb/ixgbe: Fix tests of unsigned in *_tx_map()")
---
 drivers/net/ethernet/intel/igbvf/netdev.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/intel/igbvf/netdev.c +0 -2
index 5d04541072b3..88c6ce5040e2 100644
@@ -2190,8 +2190,6 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter,
 	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--) {
Signature · 1 line
2.53.0