]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
igc: fix page fault in XDP TX timestamps handling
authorZdenek Bouska <zdenek.bouska@siemens.com>
Wed, 25 Feb 2026 09:58:29 +0000 (10:58 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2026 10:08:54 +0000 (11:08 +0100)
[ Upstream commit 45b33e805bd39f615d9353a7194b2da5281332df ]

If an XDP application that requested TX timestamping is shutting down
while the link of the interface in use is still up the following kernel
splat is reported:

[  883.803618] [   T1554] BUG: unable to handle page fault for address: ffffcfb6200fd008
...
[  883.803650] [   T1554] Call Trace:
[  883.803652] [   T1554]  <TASK>
[  883.803654] [   T1554]  igc_ptp_tx_tstamp_event+0xdf/0x160 [igc]
[  883.803660] [   T1554]  igc_tsync_interrupt+0x2d5/0x300 [igc]
...

During shutdown of the TX ring the xsk_meta pointers are left behind, so
that the IRQ handler is trying to touch them.

This issue is now being fixed by cleaning up the stale xsk meta data on
TX shutdown. TX timestamps on other queues remain unaffected.

Fixes: 15fd021bc427 ("igc: Add Tx hardware timestamp request for AF_XDP zero-copy packet")
Signed-off-by: Zdenek Bouska <zdenek.bouska@siemens.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Florian Bezdeka <florian.bezdeka@siemens.com>
Tested-by: Avigail Dahan <avigailx.dahan@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/igc/igc.h
drivers/net/ethernet/intel/igc/igc_main.c
drivers/net/ethernet/intel/igc/igc_ptp.c

index 79d5fc5ac4fcecea5fed1703026dd845f0017418..24949a50037efa6c6137a81ffcabfd0ed2647d55 100644 (file)
@@ -745,6 +745,8 @@ ktime_t igc_ptp_rx_pktstamp(struct igc_adapter *adapter, __le32 *buf);
 int igc_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
 int igc_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
 void igc_ptp_tx_hang(struct igc_adapter *adapter);
+void igc_ptp_clear_xsk_tx_tstamp_queue(struct igc_adapter *adapter,
+                                      u16 queue_id);
 void igc_ptp_read(struct igc_adapter *adapter, struct timespec64 *ts);
 void igc_ptp_tx_tstamp_event(struct igc_adapter *adapter);
 
index 65134be59754fd94d3b698e27a52a8b61dfb9d5a..6fcf4fd7ee194a475cb00eaf059cd5f8592bc8ea 100644 (file)
@@ -264,6 +264,13 @@ static void igc_clean_tx_ring(struct igc_ring *tx_ring)
        /* reset next_to_use and next_to_clean */
        tx_ring->next_to_use = 0;
        tx_ring->next_to_clean = 0;
+
+       /* Clear any lingering XSK TX timestamp requests */
+       if (test_bit(IGC_RING_FLAG_TX_HWTSTAMP, &tx_ring->flags)) {
+               struct igc_adapter *adapter = netdev_priv(tx_ring->netdev);
+
+               igc_ptp_clear_xsk_tx_tstamp_queue(adapter, tx_ring->queue_index);
+       }
 }
 
 /**
index a272d1a29eadb3c848ae78d8e744eca5280a4a68..9ff73e7532e5eb9c50fc991c231f91c7138f7c91 100644 (file)
@@ -587,6 +587,39 @@ static void igc_ptp_clear_tx_tstamp(struct igc_adapter *adapter)
        spin_unlock_irqrestore(&adapter->ptp_tx_lock, flags);
 }
 
+/**
+ * igc_ptp_clear_xsk_tx_tstamp_queue - Clear pending XSK TX timestamps for a queue
+ * @adapter: Board private structure
+ * @queue_id: TX queue index to clear timestamps for
+ *
+ * Iterates over all TX timestamp registers and releases any pending
+ * timestamp requests associated with the given TX queue. This is
+ * called when an XDP pool is being disabled to ensure no stale
+ * timestamp references remain.
+ */
+void igc_ptp_clear_xsk_tx_tstamp_queue(struct igc_adapter *adapter, u16 queue_id)
+{
+       unsigned long flags;
+       int i;
+
+       spin_lock_irqsave(&adapter->ptp_tx_lock, flags);
+
+       for (i = 0; i < IGC_MAX_TX_TSTAMP_REGS; i++) {
+               struct igc_tx_timestamp_request *tstamp = &adapter->tx_tstamp[i];
+
+               if (tstamp->buffer_type != IGC_TX_BUFFER_TYPE_XSK)
+                       continue;
+               if (tstamp->xsk_queue_index != queue_id)
+                       continue;
+               if (!tstamp->xsk_tx_buffer)
+                       continue;
+
+               igc_ptp_free_tx_buffer(adapter, tstamp);
+       }
+
+       spin_unlock_irqrestore(&adapter->ptp_tx_lock, flags);
+}
+
 static void igc_ptp_disable_tx_timestamp(struct igc_adapter *adapter)
 {
        struct igc_hw *hw = &adapter->hw;