public inbox for intel-wired-lan@osuosl.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH v2 net] e1000/e1000e: Fix leak in DMA error cleanup
@ 2026-02-24 23:28 Matt Vollrath
  0 siblings, 0 replies; only message in thread
From: Matt Vollrath @ 2026-02-24 23:28 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: anthony.l.nguyen

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 03b1320dfcee ("e1000e: remove use of skb_dma_map from e1000e
driver")
Commit 602c0554d7b0 ("e1000: remove use of skb_dma_map from e1000 driver")

Commit c1fa347f20f1 ("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: c1fa347f20f1 ("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>
---
  drivers/net/ethernet/intel/e1000/e1000_main.c | 2 --
  drivers/net/ethernet/intel/e1000e/netdev.c    | 2 --
  2 files changed, 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c 
b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 7f078ec9c14c..15160427c8b3 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -2952,8 +2952,6 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
  dma_error:
  	dev_err(&pdev->dev, "TX DMA map failed\n");
  	buffer_info->dma = 0;
-	if (count)
-		count--;

  	while (count--) {
  		if (i == 0)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c 
b/drivers/net/ethernet/intel/e1000e/netdev.c
index ddbe2f7d8112..6bcb57609d16 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -5654,8 +5654,6 @@ static int e1000_tx_map(struct e1000_ring 
*tx_ring, struct sk_buff *skb,
  dma_error:
  	dev_err(&pdev->dev, "Tx DMA map failed\n");
  	buffer_info->dma = 0;
-	if (count)
-		count--;

  	while (count--) {
  		if (i == 0)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-24 23:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24 23:28 [Intel-wired-lan] [PATCH v2 net] e1000/e1000e: Fix leak in DMA error cleanup Matt Vollrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox