* [PATCH iwl-net 1/3] e1000e: fix Rx skb DMA map error sentinel
2026-09-02 3:29 [PATCH iwl-net 0/3] e1000e: fix Rx bugs Matt Vollrath
@ 2026-09-02 3:29 ` Matt Vollrath
2026-09-02 3:29 ` [PATCH iwl-net 2/3] e1000e: fix ps_pages " Matt Vollrath
2026-09-02 3:29 ` [PATCH iwl-net 3/3] e1000e: fix NETIF_F_RXALL buffer overrun Matt Vollrath
2 siblings, 0 replies; 5+ messages in thread
From: Matt Vollrath @ 2026-09-02 3:29 UTC (permalink / raw)
To: intel-wired-lan
Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
Matt Vollrath, stable
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.
Signed-off-by: Matt Vollrath <tactii@gmail.com>
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
---
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;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH iwl-net 2/3] e1000e: fix ps_pages DMA map error sentinel
2026-09-02 3:29 [PATCH iwl-net 0/3] e1000e: fix Rx bugs Matt Vollrath
2026-09-02 3:29 ` [PATCH iwl-net 1/3] e1000e: fix Rx skb DMA map error sentinel Matt Vollrath
@ 2026-09-02 3:29 ` Matt Vollrath
2026-09-02 3:29 ` [PATCH iwl-net 3/3] e1000e: fix NETIF_F_RXALL buffer overrun Matt Vollrath
2 siblings, 0 replies; 5+ messages in thread
From: Matt Vollrath @ 2026-09-02 3:29 UTC (permalink / raw)
To: intel-wired-lan
Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
Matt Vollrath, stable
While allocating packet-split buffer pages, a failed DMA mapping would
leave DMA_MAPPING_ERROR in the ps_page->dma field.
This would have two consequences:
* The next attempt to allocate that buffer would write DMA_MAPPING_ERROR
to h/w if all pages are allocated. If the h/w uses that buffer and is
handling a frame large enough to touch the affected page, it would
cause a DMA fault and be dropped. The driver would then call
dma_unmap_page() on DMA_MAPPING_ERROR and unknowingly send the
uninitialized page up the stack as part of the frame payload.
* On ring teardown, dma_unmap_page() would be called on
DMA_MAPPING_ERROR.
This condition is only reachable when MTU > 1500 and PAGE_SIZE <= 16K.
Fix this by setting ps_page->dma = 0 upon mapping failure and separately
testing ->page and ->dma during allocation and teardown.
The rewrite of the ps_pages section of e1000_clean_rx_ring was necessary
to recognize the case of a mapped page without a valid DMA mapping. It
also fixes a separate bug which would potentially leak pages on ring
teardown. The cleaner stops cleaning pages when h/w reported that it did
not write to a page in the sequence, leaving the following pages
allocated and mapped. The teardown would then break early and leak the
unused mapped pages. If the ring is re-allocated with similar
configuration, it would reclaim those lost pages. This would only affect
configurations with rx_ps_pages >= 2 (MTU > PAGE_SIZE) and the same
condition of MTU > 1500 and PAGE_SIZE <= 16K.
Signed-off-by: Matt Vollrath <tactii@gmail.com>
Assisted-by: Claude:claude-5-fable
Fixes: bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver (currently for ICH9 devices only)")
Cc: stable@vger.kernel.org
---
drivers/net/ethernet/intel/e1000e/netdev.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 26f45ee8c7e7..063fc8cd2673 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -759,12 +759,15 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_ring *rx_ring,
adapter->alloc_rx_buff_failed++;
goto no_buffers;
}
+ }
+ if (!ps_page->dma) {
ps_page->dma = dma_map_page(&pdev->dev,
ps_page->page,
0, PAGE_SIZE,
DMA_FROM_DEVICE);
if (dma_mapping_error(&pdev->dev,
ps_page->dma)) {
+ ps_page->dma = 0;
dev_err(&adapter->pdev->dev,
"Rx DMA page map failed\n");
adapter->rx_dma_failed++;
@@ -1722,13 +1725,15 @@ static void e1000_clean_rx_ring(struct e1000_ring *rx_ring)
for (j = 0; j < PS_PAGE_BUFFERS; j++) {
ps_page = &buffer_info->ps_pages[j];
- if (!ps_page->page)
- break;
- dma_unmap_page(&pdev->dev, ps_page->dma, PAGE_SIZE,
- DMA_FROM_DEVICE);
- ps_page->dma = 0;
- put_page(ps_page->page);
- ps_page->page = NULL;
+ if (ps_page->dma) {
+ dma_unmap_page(&pdev->dev, ps_page->dma,
+ PAGE_SIZE, DMA_FROM_DEVICE);
+ ps_page->dma = 0;
+ }
+ if (ps_page->page) {
+ put_page(ps_page->page);
+ ps_page->page = NULL;
+ }
}
}
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH iwl-net 3/3] e1000e: fix NETIF_F_RXALL buffer overrun
2026-09-02 3:29 [PATCH iwl-net 0/3] e1000e: fix Rx bugs Matt Vollrath
2026-09-02 3:29 ` [PATCH iwl-net 1/3] e1000e: fix Rx skb DMA map error sentinel Matt Vollrath
2026-09-02 3:29 ` [PATCH iwl-net 2/3] e1000e: fix ps_pages " Matt Vollrath
@ 2026-09-02 3:29 ` Matt Vollrath
2026-09-03 16:00 ` Matt Vollrath
2 siblings, 1 reply; 5+ messages in thread
From: Matt Vollrath @ 2026-09-02 3:29 UTC (permalink / raw)
To: intel-wired-lan
Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
Matt Vollrath, stable
When SBP is set, the card may deliver frames which would otherwise be
filtered out by LPE being unset. This would allow the device to write
up to 526 bytes beyond the skb's data allocation: over its own shinfo,
and beyond. This bug is reachable only when MTU <= 1500 and
NETIF_F_RXALL is set ("ethtool -K <dev> rx-all on").
Ensure that buffers are large enough for an entire 2048 byte chunk when
NETIF_F_RXALL is set. Do this by moving final rx_buffer_len
determination to one place, right before RCTL.BSIZE is determined. This
will correctly re-evaluate every time the adapter is configured, not
just on MTU change.
Signed-off-by: Matt Vollrath <tactii@gmail.com>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Assisted-by: Claude:claude-5-fable
Fixes: cf955e6c96cb ("e1000e: Support RXALL feature flag.")
Cc: stable@vger.kernel.org
---
drivers/net/ethernet/intel/e1000e/netdev.c | 53 +++++++++++++---------
1 file changed, 32 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 063fc8cd2673..80d5a0010df8 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -3036,6 +3036,33 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
#define PAGE_USE_COUNT(S) (((S) >> PAGE_SHIFT) + \
(((S) & (PAGE_SIZE - 1)) ? 1 : 0))
+/**
+ * e1000_set_rx_buffer_len - determine the Rx buffer size
+ * @adapter: Board private structure
+ **/
+static void e1000_set_rx_buffer_len(struct e1000_adapter *adapter)
+{
+ struct net_device *netdev = adapter->netdev;
+ u32 max_frame = adapter->max_frame_size;
+
+ /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
+ * means we reserve 2 more, this pushes us to allocate from the next
+ * larger slab size.
+ * i.e. RXBUFFER_2048 --> size-4096 slab
+ * However with the new *_jumbo_rx* routines, jumbo receives will use
+ * fragmented skbs
+ */
+ if (max_frame <= 2048)
+ adapter->rx_buffer_len = 2048;
+ else
+ adapter->rx_buffer_len = 4096;
+
+ /* adjust allocation if LPE protects us, and we aren't using SBP */
+ if (max_frame <= (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN) &&
+ !(netdev->features & NETIF_F_RXALL))
+ adapter->rx_buffer_len = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN;
+}
+
/**
* e1000_setup_rctl - configure the receive control registers
* @adapter: Board private structure
@@ -3102,6 +3129,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
e1e_wphy(hw, 22, phy_data);
}
+ e1000_set_rx_buffer_len(adapter);
+
/* Setup buffer sizes */
rctl &= ~E1000_RCTL_SZ_4096;
rctl |= E1000_RCTL_BSEX;
@@ -6087,30 +6116,12 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
pm_runtime_get_sync(netdev->dev.parent);
- if (netif_running(netdev))
+ if (netif_running(netdev)) {
e1000e_down(adapter, true);
-
- /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
- * means we reserve 2 more, this pushes us to allocate from the next
- * larger slab size.
- * i.e. RXBUFFER_2048 --> size-4096 slab
- * However with the new *_jumbo_rx* routines, jumbo receives will use
- * fragmented skbs
- */
-
- if (max_frame <= 2048)
- adapter->rx_buffer_len = 2048;
- else
- adapter->rx_buffer_len = 4096;
-
- /* adjust allocation if LPE protects us, and we aren't using SBP */
- if (max_frame <= (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN))
- adapter->rx_buffer_len = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN;
-
- if (netif_running(netdev))
e1000e_up(adapter);
- else
+ } else {
e1000e_reset(adapter);
+ }
pm_runtime_put_sync(netdev->dev.parent);
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH iwl-net 3/3] e1000e: fix NETIF_F_RXALL buffer overrun
2026-09-02 3:29 ` [PATCH iwl-net 3/3] e1000e: fix NETIF_F_RXALL buffer overrun Matt Vollrath
@ 2026-09-03 16:00 ` Matt Vollrath
0 siblings, 0 replies; 5+ messages in thread
From: Matt Vollrath @ 2026-09-03 16:00 UTC (permalink / raw)
To: intel-wired-lan
Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
stable
On 9/1/26 23:29, Matt Vollrath wrote:
> When SBP is set, the card may deliver frames which would otherwise be
> filtered out by LPE being unset. This would allow the device to write
> up to 526 bytes beyond the skb's data allocation: over its own shinfo,
> and beyond. This bug is reachable only when MTU <= 1500 and
> NETIF_F_RXALL is set ("ethtool -K <dev> rx-all on").
>
> Ensure that buffers are large enough for an entire 2048 byte chunk when
> NETIF_F_RXALL is set. Do this by moving final rx_buffer_len
> determination to one place, right before RCTL.BSIZE is determined. This
> will correctly re-evaluate every time the adapter is configured, not
> just on MTU change.
>
> Signed-off-by: Matt Vollrath <tactii@gmail.com>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Assisted-by: Claude:claude-5-fable
> Fixes: cf955e6c96cb ("e1000e: Support RXALL feature flag.")
> Cc: stable@vger.kernel.org
> ---
> drivers/net/ethernet/intel/e1000e/netdev.c | 53 +++++++++++++---------
> 1 file changed, 32 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 063fc8cd2673..80d5a0010df8 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -3036,6 +3036,33 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
> #define PAGE_USE_COUNT(S) (((S) >> PAGE_SHIFT) + \
> (((S) & (PAGE_SIZE - 1)) ? 1 : 0))
>
> +/**
> + * e1000_set_rx_buffer_len - determine the Rx buffer size
> + * @adapter: Board private structure
> + **/
> +static void e1000_set_rx_buffer_len(struct e1000_adapter *adapter)
> +{
> + struct net_device *netdev = adapter->netdev;
> + u32 max_frame = adapter->max_frame_size;
> +
> + /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
> + * means we reserve 2 more, this pushes us to allocate from the next
> + * larger slab size.
> + * i.e. RXBUFFER_2048 --> size-4096 slab
> + * However with the new *_jumbo_rx* routines, jumbo receives will use
> + * fragmented skbs
> + */
> + if (max_frame <= 2048)
> + adapter->rx_buffer_len = 2048;
> + else
> + adapter->rx_buffer_len = 4096;
> +
> + /* adjust allocation if LPE protects us, and we aren't using SBP */
> + if (max_frame <= (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN) &&
> + !(netdev->features & NETIF_F_RXALL))
> + adapter->rx_buffer_len = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN;
> +}
> +
> /**
> * e1000_setup_rctl - configure the receive control registers
> * @adapter: Board private structure
> @@ -3102,6 +3129,8 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
> e1e_wphy(hw, 22, phy_data);
> }
>
> + e1000_set_rx_buffer_len(adapter);
> +
> /* Setup buffer sizes */
> rctl &= ~E1000_RCTL_SZ_4096;
> rctl |= E1000_RCTL_BSEX;
> @@ -6087,30 +6116,12 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
>
> pm_runtime_get_sync(netdev->dev.parent);
>
> - if (netif_running(netdev))
> + if (netif_running(netdev)) {
I see now that I should not have collapsed this to one netif_running check.
> e1000e_down(adapter, true);
> -
> - /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
> - * means we reserve 2 more, this pushes us to allocate from the next
> - * larger slab size.
> - * i.e. RXBUFFER_2048 --> size-4096 slab
> - * However with the new *_jumbo_rx* routines, jumbo receives will use
> - * fragmented skbs
> - */
> -
> - if (max_frame <= 2048)
> - adapter->rx_buffer_len = 2048;
> - else
> - adapter->rx_buffer_len = 4096;
> -
> - /* adjust allocation if LPE protects us, and we aren't using SBP */
> - if (max_frame <= (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN))
> - adapter->rx_buffer_len = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN;
> -
> - if (netif_running(netdev))
> e1000e_up(adapter);
> - else
> + } else {
> e1000e_reset(adapter);
> + }
>
> pm_runtime_put_sync(netdev->dev.parent);
>
^ permalink raw reply [flat|nested] 5+ messages in thread