Skip to content

Commit e94eaef

Browse files
mvollrathanguy11
authored andcommitted
e1000/e1000e: Fix leak in DMA error cleanup
If an error is encountered while mapping TX buffers, the driver should unmap any buffers already mapped for that skb. Because count is incremented after a successful 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 would leak. In these commits, a faulty while condition caused an infinite loop in dma_error: Commit 03b1320 ("e1000e: remove use of skb_dma_map from e1000e driver") Commit 602c055 ("e1000: remove use of skb_dma_map from e1000 driver") Commit c1fa347 ("e1000/e1000e/igb/igbvf/ixgb/ixgbe: Fix tests of unsigned in *_tx_map()") fixed the infinite loop, but introduced the off-by-one error. This issue may still exist in the igbvf driver, but I did not address it in this patch. Fixes: c1fa347 ("e1000/e1000e/igb/igbvf/ixgb/ixgbe: Fix tests of unsigned in *_tx_map()") Assisted-by: Claude:claude-4.6-opus Signed-off-by: Matt Vollrath <tactii@gmail.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent e809085 commit e94eaef

2 files changed

Lines changed: 0 additions & 4 deletions

File tree

drivers/net/ethernet/intel/e1000/e1000_main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2952,8 +2952,6 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
29522952
dma_error:
29532953
dev_err(&pdev->dev, "TX DMA map failed\n");
29542954
buffer_info->dma = 0;
2955-
if (count)
2956-
count--;
29572955

29582956
while (count--) {
29592957
if (i == 0)

drivers/net/ethernet/intel/e1000e/netdev.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5652,8 +5652,6 @@ static int e1000_tx_map(struct e1000_ring *tx_ring, struct sk_buff *skb,
56525652
dma_error:
56535653
dev_err(&pdev->dev, "Tx DMA map failed\n");
56545654
buffer_info->dma = 0;
5655-
if (count)
5656-
count--;
56575655

56585656
while (count--) {
56595657
if (i == 0)

0 commit comments

Comments
 (0)