Thread (8 messages) 8 messages, 4 authors, 17d ago

Re: [PATCH iwl-net v2 1/2] e1000e: fix Rx skb DMA map error sentinel

flat view

From: Ruinskiy, Dima <hidden>
Date: 2026-10-05 18:11:29
Also in: intel-wired-lan, stable

On 13/09/2026 20:15, Matt Vollrath wrote:
quoted hunk ↗ jump to hunk
Upon encountering a DMA_MAPPING_ERROR during skb allocation and mapping,
the driver would leave DMA_MAPPING_ERROR in the buffer_info->dma field.
This would lead several buffer_info->dma == 0 conditions down unwanted
paths:

* In e1000_alloc_jumbo_rx_buffers(), it would not re-attempt the failed
   mapping and instead write DMA_MAPPING_ERROR to the h/w descriptor on
   the next allocation call. On cleaning or teardown it would attempt to
   dma_unmap_page() DMA_MAPPING_ERROR. This case would only be
   reachable at MTU > 1518 and page size > 16K.
* In e1000_clean_rx_ring(), it would attempt to dma_unmap_page/single()
   DMA_MAPPING_ERROR (unless cleaned by the jumbo path first). This case
   would be reachable at any combination of MTU and page size.

Use buffer_info->dma = 0 as the sentinel for "DMA is not mapped." Set it
immediately upon detecting the failure.

The map error value was 0 on some platforms (including most common x86)
until error values were unified to DMA_MAPPING_ERROR in v4.20/v5.0.
Since then the error handling in this driver has been incorrect on all
platforms.

Signed-off-by: Matt Vollrath <redacted>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Fixes: bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver (currently for ICH9 devices only)")
Cc: stable@vger.kernel.org
---
v2:
* Add history blurb to description.
---
  drivers/net/ethernet/intel/e1000e/netdev.c | 3 +++
  1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 844f31ab37ad..26f45ee8c7e7 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -691,6 +691,7 @@ static void e1000_alloc_rx_buffers(struct e1000_ring *rx_ring,
  						  adapter->rx_buffer_len,
  						  DMA_FROM_DEVICE);
  		if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
+			buffer_info->dma = 0;
  			dev_err(&pdev->dev, "Rx DMA map failed\n");
  			adapter->rx_dma_failed++;
  			break;
@@ -791,6 +792,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_ring *rx_ring,
  						  adapter->rx_ps_bsize0,
  						  DMA_FROM_DEVICE);
  		if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
+			buffer_info->dma = 0;
  			dev_err(&pdev->dev, "Rx DMA map failed\n");
  			adapter->rx_dma_failed++;
  			/* cleanup skb */
@@ -877,6 +879,7 @@ static void e1000_alloc_jumbo_rx_buffers(struct e1000_ring *rx_ring,
  							PAGE_SIZE,
  							DMA_FROM_DEVICE);
  			if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
+				buffer_info->dma = 0;
  				adapter->alloc_rx_buff_failed++;
  				break;
  			}
base-commit: 78445023439506ebd83b86d40b1e428a3b309d4a
Reviewed-by: Dima Ruinskiy <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help