Skip to contentSkip to conversation

wifi: iwlwifi: mld: fix UAF and soft lockup on firmware error

PATCH In review Cole Leavitt 3 participants 8 messages Apr 5 – Apr 20 1 message not in the archive

Subsystems (2)

v2 of 3 In review Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover wifi: iwlwifi: mld: fix UAF and soft lockup on firmware error

Three fixes for the iwlmld sub-driver addressing use-after-free, TSO segmentation explosion, and soft lockups during firmware error recovery on Intel BE200 (WiFi7).

1/3 closes the NAPI race window where stale RX data from dying firmware reaches the TX completion handlers, causing corrupt SSN values to trigger skb use-after-free in iwl_trans_reclaim(). Ben Greear confirmed the WARN_ONCE fires on his test systems.

2/3 fixes the TSO segmentation explosion when AMSDU is disabled for a TID. The TLC notification sets max_tid_amsdu_len to the sentinel value 1, which slips past the existing zero check and produces num_subframes=0, causing skb_gso_segment() to create 32000+ tiny segments. Revised per Miriam Korenblit's feedback to check for the sentinel value directly and add a WARN_ON_ONCE guard after the division as defense-in-depth.

3/3 adds STATUS_FW_ERROR checks in the TX pull path to stop feeding frames to dead firmware. Revised per Johannes Berg's feedback to use status bit checks instead of stop_queues/wake_queues, which doesn't interact well with TXQ-based APIs.

Changes since v1:
- 1/3: Added Tested-by from Ben Greear
- 2/3: Check max_tid_amsdu_len == 1 (sentinel) instead of guarding !num_subframes after division; added WARN_ON_ONCE defense-in-depth (Suggested-by: Miriam Korenblit)
- 3/3: Replaced ieee80211_stop_queues()/wake_queues() with STATUS_FW_ERROR checks in TX pull path (per Johannes Berg)

Cole Leavitt (3):
wifi: iwlwifi: prevent NAPI processing after firmware error
wifi: iwlwifi: mld: fix TSO segmentation explosion when AMSDU is
disabled
wifi: iwlwifi: mld: skip TX when firmware is dead

 .../net/wireless/intel/iwlwifi/mld/mac80211.c |   4 +
 drivers/net/wireless/intel/iwlwifi/mld/tx.c   | 210 +++++------
 .../wireless/intel/iwlwifi/pcie/gen1_2/rx.c   | 337 +++++++++---------
 3 files changed, 284 insertions(+), 267 deletions(-)

base-commit: 3aae9383f42f687221c011d7ee87529398e826b3

Signature · 1 line
2.52.0
#1 lore raw

PATCH v2 1/3 wifi: iwlwifi: prevent NAPI processing after firmware error

After a firmware error is detected and STATUS_FW_ERROR is set, NAPI can still be actively polling or get scheduled from a prior interrupt. The NAPI poll functions (both legacy and MSIX variants) have no check for STATUS_FW_ERROR and will continue processing stale RX ring entries from dying firmware. This can dispatch TX completion notifications containing corrupt SSN values to iwl_mld_handle_tx_resp_notif(), which passes them to iwl_trans_reclaim(). If the corrupt SSN causes reclaim to walk TX queue entries that were already freed by a prior correct reclaim, the result is an skb use-after-free or double-free.

The race window opens when the MSIX IRQ handler schedules NAPI (lines 2319-2321 in rx.c) before processing the error bit (lines 2382-2396), or when NAPI is already running on another CPU from a previous interrupt when STATUS_FW_ERROR gets set on the current CPU.

Add STATUS_FW_ERROR checks to both NAPI poll functions to prevent processing stale RX data after firmware error, and add early-return guards in the TX response and compressed BA notification handlers as defense-in-depth. Each check uses WARN_ONCE to log if the race is actually hit, which aids diagnosis of the hard-to-reproduce skb use-after-free reported on Intel BE200.

Note that _iwl_trans_pcie_gen2_stop_device() already calls iwl_pcie_rx_napi_sync() to quiesce NAPI during device teardown, but that runs much later in the restart sequence. These checks close the window between error detection and device stop.

Fixes d1e879ec600f ("wifi: iwlwifi: add iwlmld sub-driver")
---
 drivers/net/wireless/intel/iwlwifi/mld/tx.c   | 202 +++++------
 .../wireless/intel/iwlwifi/pcie/gen1_2/rx.c   | 337 +++++++++---------
 2 files changed, 273 insertions(+), 266 deletions(-)
drivers/net/wireless/intel/iwlwifi/mld/tx.c +101 -101
index 546d09a38dab..e341d12e5233 100644
@@ -44,8 +44,8 @@ void iwl_mld_toggle_tx_ant(struct iwl_mld *mld, u8 *ant)
 	*ant = iwl_mld_next_ant(iwl_mld_get_valid_tx_ant(mld), *ant);
 }
 
-static int
-iwl_mld_get_queue_size(struct iwl_mld *mld, struct ieee80211_txq *txq)
+static int iwl_mld_get_queue_size(struct iwl_mld *mld,
+				  struct ieee80211_txq *txq)
 {
 	struct ieee80211_sta *sta = txq->sta;
 	struct ieee80211_link_sta *link_sta;
@@ -74,9 +74,10 @@ static int iwl_mld_allocate_txq(struct iwl_mld *mld, struct ieee80211_txq *txq)
 	/* We can't know when the station is asleep or awake, so we
 	 * must disable the queue hang detection.
 	 */
-	unsigned int watchdog_timeout = txq->vif->type == NL80211_IFTYPE_AP ?
-				IWL_WATCHDOG_DISABLED :
-				mld->trans->mac_cfg->base->wd_timeout;
+	unsigned int watchdog_timeout =
+		txq->vif->type == NL80211_IFTYPE_AP ?
+			IWL_WATCHDOG_DISABLED :
+			mld->trans->mac_cfg->base->wd_timeout;
 	int queue, size;
 
 	lockdep_assert_wiphy(mld->wiphy);
@@ -91,9 +92,9 @@ static int iwl_mld_allocate_txq(struct iwl_mld *mld, struct ieee80211_txq *txq)
 				    watchdog_timeout);
 
 	if (queue >= 0)
-		IWL_DEBUG_TX_QUEUES(mld,
-				    "Enabling TXQ #%d for sta mask 0x%x tid %d\n",
-				    queue, fw_sta_mask, tid);
+		IWL_DEBUG_TX_QUEUES(
+			mld, "Enabling TXQ #%d for sta mask 0x%x tid %d\n",
+			queue, fw_sta_mask, tid);
 	return queue;
 }
 
@@ -123,9 +124,8 @@ void iwl_mld_add_txq_list(struct iwl_mld *mld)
 
 	while (!list_empty(&mld->txqs_to_add)) {
 		struct ieee80211_txq *txq;
-		struct iwl_mld_txq *mld_txq =
-			list_first_entry(&mld->txqs_to_add, struct iwl_mld_txq,
-					 list);
+		struct iwl_mld_txq *mld_txq = list_first_entry(
+			&mld->txqs_to_add, struct iwl_mld_txq, list);
 		int failed;
 
 		txq = container_of((void *)mld_txq, struct ieee80211_txq,
@@ -149,8 +149,7 @@ void iwl_mld_add_txq_list(struct iwl_mld *mld)
 
 void iwl_mld_add_txqs_wk(struct wiphy *wiphy, struct wiphy_work *wk)
 {
-	struct iwl_mld *mld = container_of(wk, struct iwl_mld,
-					   add_txqs_wk);
+	struct iwl_mld *mld = container_of(wk, struct iwl_mld, add_txqs_wk);
 
 	/* will reschedule to run after restart */
 	if (mld->fw_status.in_hw_restart)
@@ -159,8 +158,8 @@ void iwl_mld_add_txqs_wk(struct wiphy *wiphy, struct wiphy_work *wk)
 	iwl_mld_add_txq_list(mld);
 }
 
-void
-iwl_mld_free_txq(struct iwl_mld *mld, u32 fw_sta_mask, u32 tid, u32 queue_id)
+void iwl_mld_free_txq(struct iwl_mld *mld, u32 fw_sta_mask, u32 tid,
+		      u32 queue_id)
 {
 	struct iwl_scd_queue_cfg_cmd remove_cmd = {
 		.operation = cpu_to_le32(IWL_SCD_QUEUE_REMOVE),
@@ -193,8 +192,7 @@ void iwl_mld_remove_txq(struct iwl_mld *mld, struct ieee80211_txq *txq)
 
 	sta_msk = iwl_mld_fw_sta_id_mask(mld, txq->sta);
 
-	tid = txq->tid == IEEE80211_NUM_TIDS ? IWL_MGMT_TID :
-					       txq->tid;
+	tid = txq->tid == IEEE80211_NUM_TIDS ? IWL_MGMT_TID : txq->tid;
 
 	iwl_mld_free_txq(mld, sta_msk, tid, mld_txq->fw_id);
 
@@ -202,11 +200,9 @@ void iwl_mld_remove_txq(struct iwl_mld *mld, struct ieee80211_txq *txq)
 	mld_txq->status.allocated = false;
 }
 
-#define OPT_HDR(type, skb, off) \
-	(type *)(skb_network_header(skb) + (off))
+#define OPT_HDR(type, skb, off) (type *)(skb_network_header(skb) + (off))
 
-static __le32
-iwl_mld_get_offload_assist(struct sk_buff *skb, bool amsdu)
+static __le32 iwl_mld_get_offload_assist(struct sk_buff *skb, bool amsdu)
 {
 	struct ieee80211_hdr *hdr = (void *)skb->data;
 	u16 mh_len = ieee80211_hdrlen(hdr->frame_control);
@@ -225,7 +221,7 @@ iwl_mld_get_offload_assist(struct sk_buff *skb, bool amsdu)
 	 * the devices we support has this flags?
 	 */
 	if (WARN_ONCE(skb->protocol != htons(ETH_P_IP) &&
-		      skb->protocol != htons(ETH_P_IPV6),
+			      skb->protocol != htons(ETH_P_IPV6),
 		      "No support for requested checksum\n")) {
 		skb_checksum_help(skb);
 		goto out;
@@ -306,8 +302,8 @@ static void iwl_mld_get_basic_rates_and_band(struct iwl_mld *mld,
 					     unsigned long *basic_rates,
 					     u8 *band)
 {
-	u32 link_id = u32_get_bits(info->control.flags,
-				   IEEE80211_TX_CTRL_MLO_LINK);
+	u32 link_id =
+		u32_get_bits(info->control.flags, IEEE80211_TX_CTRL_MLO_LINK);
 
 	*basic_rates = vif->bss_conf.basic_rates;
 	*band = info->band;
@@ -333,8 +329,7 @@ static void iwl_mld_get_basic_rates_and_band(struct iwl_mld *mld,
 	}
 }
 
-u8 iwl_mld_get_lowest_rate(struct iwl_mld *mld,
-			   struct ieee80211_tx_info *info,
+u8 iwl_mld_get_lowest_rate(struct iwl_mld *mld, struct ieee80211_tx_info *info,
 			   struct ieee80211_vif *vif)
 {
 	struct ieee80211_supported_band *sband;
@@ -389,8 +384,8 @@ static u32 iwl_mld_mac80211_rate_idx_to_fw(struct iwl_mld *mld,
 
 	/* if the rate isn't a well known legacy rate, take the lowest one */
 	if (rate_idx < 0 || rate_idx >= IWL_RATE_COUNT_LEGACY)
-		rate_idx = iwl_mld_get_lowest_rate(mld, info,
-						   info->control.vif);
+		rate_idx =
+			iwl_mld_get_lowest_rate(mld, info, info->control.vif);
 
 	WARN_ON_ONCE(rate_idx < 0);
 
@@ -404,7 +399,8 @@ static u32 iwl_mld_mac80211_rate_idx_to_fw(struct iwl_mld *mld,
 	 * 0 - 3 for CCK and 0 - 7 for OFDM
 	 */
 	rate_plcp = (rate_idx >= IWL_FIRST_OFDM_RATE ?
-		     rate_idx - IWL_FIRST_OFDM_RATE : rate_idx);
+			     rate_idx - IWL_FIRST_OFDM_RATE :
+			     rate_idx);
 
 	return (u32)rate_plcp | rate_flags;
 }
@@ -424,8 +420,7 @@ static u32 iwl_mld_get_tx_ant(struct iwl_mld *mld,
 
 static u32 iwl_mld_get_inject_tx_rate(struct iwl_mld *mld,
 				      struct ieee80211_tx_info *info,
-				      struct ieee80211_sta *sta,
-				      __le16 fc)
+				      struct ieee80211_sta *sta, __le16 fc)
 {
 	struct ieee80211_tx_rate *rate = &info->control.rates[0];
 	u32 result;
@@ -492,9 +487,8 @@ static __le32 iwl_mld_get_tx_rate_n_flags(struct iwl_mld *mld,
 	return iwl_v3_rate_to_v2_v3(rate, mld->fw_rates_ver_3);
 }
 
-static void
-iwl_mld_fill_tx_cmd_hdr(struct iwl_tx_cmd *tx_cmd,
-			struct sk_buff *skb, bool amsdu)
+static void iwl_mld_fill_tx_cmd_hdr(struct iwl_tx_cmd *tx_cmd,
+				    struct sk_buff *skb, bool amsdu)
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_hdr *hdr = (void *)skb->data;
@@ -530,10 +524,9 @@ iwl_mld_fill_tx_cmd_hdr(struct iwl_tx_cmd *tx_cmd,
 	}
 }
 
-static void
-iwl_mld_fill_tx_cmd(struct iwl_mld *mld, struct sk_buff *skb,
-		    struct iwl_device_tx_cmd *dev_tx_cmd,
-		    struct ieee80211_sta *sta)
+static void iwl_mld_fill_tx_cmd(struct iwl_mld *mld, struct sk_buff *skb,
+				struct iwl_device_tx_cmd *dev_tx_cmd,
+				struct ieee80211_sta *sta)
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_hdr *hdr = (void *)skb->data;
@@ -561,8 +554,7 @@ iwl_mld_fill_tx_cmd(struct iwl_mld *mld, struct sk_buff *skb,
 		rate_n_flags = iwl_mld_get_tx_rate_n_flags(mld, info, sta,
 							   hdr->frame_control);
 	} else if (!ieee80211_is_data(hdr->frame_control) ||
-		   (mld_sta &&
-		    mld_sta->sta_state < IEEE80211_STA_AUTHORIZED)) {
+		   (mld_sta && mld_sta->sta_state < IEEE80211_STA_AUTHORIZED)) {
 		/* These are important frames */
 		flags |= IWL_TX_FLAGS_HIGH_PRI;
 	}
@@ -587,8 +579,8 @@ iwl_mld_get_link_from_tx_info(struct ieee80211_tx_info *info)
 {
 	struct iwl_mld_vif *mld_vif =
 		iwl_mld_vif_from_mac80211(info->control.vif);
-	u32 link_id = u32_get_bits(info->control.flags,
-				   IEEE80211_TX_CTRL_MLO_LINK);
+	u32 link_id =
+		u32_get_bits(info->control.flags, IEEE80211_TX_CTRL_MLO_LINK);
 
 	if (link_id == IEEE80211_LINK_UNSPECIFIED) {
 		if (info->control.vif->active_links)
@@ -600,9 +592,9 @@ iwl_mld_get_link_from_tx_info(struct ieee80211_tx_info *info)
 	return rcu_dereference(mld_vif->link[link_id]);
 }
 
-static int
-iwl_mld_get_tx_queue_id(struct iwl_mld *mld, struct ieee80211_txq *txq,
-			struct sk_buff *skb)
+static int iwl_mld_get_tx_queue_id(struct iwl_mld *mld,
+				   struct ieee80211_txq *txq,
+				   struct sk_buff *skb)
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct ieee80211_hdr *hdr = (void *)skb->data;
@@ -686,8 +678,7 @@ iwl_mld_get_tx_queue_id(struct iwl_mld *mld, struct ieee80211_txq *txq,
 	return IWL_MLD_INVALID_QUEUE;
 }
 
-static void iwl_mld_probe_resp_set_noa(struct iwl_mld *mld,
-				       struct sk_buff *skb)
+static void iwl_mld_probe_resp_set_noa(struct iwl_mld *mld, struct sk_buff *skb)
 {
 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 	struct iwl_mld_link *mld_link =
@@ -709,8 +700,7 @@ static void iwl_mld_probe_resp_set_noa(struct iwl_mld *mld,
 
 	if (skb_tailroom(skb) < resp_data->noa_len) {
 		if (pskb_expand_head(skb, 0, resp_data->noa_len, GFP_ATOMIC)) {
-			IWL_ERR(mld,
-				"Failed to reallocate probe resp\n");
+			IWL_ERR(mld, "Failed to reallocate probe resp\n");
 			goto out;
 		}
 	}
@@ -770,8 +760,7 @@ static int iwl_mld_tx_mpdu(struct iwl_mld *mld, struct sk_buff *skb,
 			tid = IWL_TID_NON_QOS;
 	}
 
-	IWL_DEBUG_TX(mld, "TX TID:%d from Q:%d len %d\n",
-		     tid, queue, skb->len);
+	IWL_DEBUG_TX(mld, "TX TID:%d from Q:%d len %d\n", tid, queue, skb->len);
 
 	/* From now on, we cannot access info->control */
 	memset(&info->status, 0, sizeof(info->status));
@@ -824,7 +813,7 @@ static int iwl_mld_tx_tso_segment(struct iwl_mld *mld, struct sk_buff *skb,
 	 */
 	if (skb->protocol == htons(ETH_P_IPV6) &&
 	    ((struct ipv6hdr *)skb_network_header(skb))->nexthdr !=
-	    IPPROTO_TCP) {
+		    IPPROTO_TCP) {
 		netdev_flags &= ~NETIF_F_CSUM_MASK;
 		return iwl_tx_tso_segment(skb, 1, netdev_flags, mpdus_skbs);
 	}
@@ -851,7 +840,7 @@ static int iwl_mld_tx_tso_segment(struct iwl_mld *mld, struct sk_buff *skb,
 		num_subframes = sta->max_amsdu_subframes;
 
 	tcp_payload_len = skb_tail_pointer(skb) - skb_transport_header(skb) -
-		tcp_hdrlen(skb) + skb->data_len;
+			  tcp_hdrlen(skb) + skb->data_len;
 
 	/* Make sure we have enough TBs for the A-MSDU:
 	 *	2 for each subframe
@@ -893,7 +882,7 @@ static int iwl_mld_tx_tso(struct iwl_mld *mld, struct sk_buff *skb,
 		return -1;
 
 	payload_len = skb_tail_pointer(skb) - skb_transport_header(skb) -
-		tcp_hdrlen(skb) + skb->data_len;
+		      tcp_hdrlen(skb) + skb->data_len;
 
 	if (payload_len <= skb_shinfo(skb)->gso_size)
 		return iwl_mld_tx_mpdu(mld, skb, txq);
@@ -1011,8 +1000,8 @@ static void iwl_mld_hwrate_to_tx_rate(struct iwl_mld *mld,
 {
 	enum nl80211_band band = info->band;
 	struct ieee80211_tx_rate *tx_rate = &info->status.rates[0];
-	u32 rate_n_flags = iwl_v3_rate_from_v2_v3(rate_n_flags_fw,
-						  mld->fw_rates_ver_3);
+	u32 rate_n_flags =
+		iwl_v3_rate_from_v2_v3(rate_n_flags_fw, mld->fw_rates_ver_3);
 	u32 sgi = rate_n_flags & RATE_MCS_SGI_MSK;
 	u32 chan_width = rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK;
 	u32 format = rate_n_flags & RATE_MCS_MOD_TYPE_MSK;
@@ -1042,10 +1031,9 @@ static void iwl_mld_hwrate_to_tx_rate(struct iwl_mld *mld,
 		tx_rate->idx = RATE_HT_MCS_INDEX(rate_n_flags);
 		break;
 	case RATE_MCS_MOD_TYPE_VHT:
-		ieee80211_rate_set_vht(tx_rate,
-				       rate_n_flags & RATE_MCS_CODE_MSK,
-				       u32_get_bits(rate_n_flags,
-						    RATE_MCS_NSS_MSK) + 1);
+		ieee80211_rate_set_vht(
+			tx_rate, rate_n_flags & RATE_MCS_CODE_MSK,
+			u32_get_bits(rate_n_flags, RATE_MCS_NSS_MSK) + 1);
 		tx_rate->flags |= IEEE80211_TX_RC_VHT_MCS;
 		break;
 	case RATE_MCS_MOD_TYPE_HE:
@@ -1056,9 +1044,8 @@ static void iwl_mld_hwrate_to_tx_rate(struct iwl_mld *mld,
 		tx_rate->idx = 0;
 		break;
 	default:
-		tx_rate->idx =
-			iwl_mld_legacy_hw_idx_to_mac80211_idx(rate_n_flags,
-							      band);
+		tx_rate->idx = iwl_mld_legacy_hw_idx_to_mac80211_idx(
+			rate_n_flags, band);
 		break;
 	}
 }
@@ -1082,6 +1069,19 @@ void iwl_mld_handle_tx_resp_notif(struct iwl_mld *mld,
 	bool mgmt = false;
 	bool tx_failure = (status & TX_STATUS_MSK) != TX_STATUS_SUCCESS;
 
+	/* Firmware is dead — the TX response may contain corrupt SSN values
+	 * from a dying firmware DMA. Processing it could cause
+	 * iwl_trans_reclaim() to free the wrong TX queue entries, leading to
+	 * skb use-after-free or double-free.
+	 */
+	if (unlikely(test_bit(STATUS_FW_ERROR, &mld->trans->status))) {
+		WARN_ONCE(
+			1,
+			"iwlwifi: TX resp notif (sta=%d txq=%d) after FW error\n",
+			sta_id, txq_id);
+		return;
+	}
+
 	if (IWL_FW_CHECK(mld, tx_resp->frame_count != 1,
 			 "Invalid tx_resp notif frame_count (%d)\n",
 			 tx_resp->frame_count))
@@ -1093,8 +1093,8 @@ void iwl_mld_handle_tx_resp_notif(struct iwl_mld *mld,
 			 notif_size, pkt_len))
 		return;
 
-	ssn = le32_to_cpup((__le32 *)agg_status +
-			   tx_resp->frame_count) & 0xFFFF;
+	ssn = le32_to_cpup((__le32 *)agg_status + tx_resp->frame_count) &
+	      0xFFFF;
 
 	__skb_queue_head_init(&skbs);
 
@@ -1112,7 +1112,8 @@ void iwl_mld_handle_tx_resp_notif(struct iwl_mld *mld,
 
 		memset(&info->status, 0, sizeof(info->status));
 
-		info->flags &= ~(IEEE80211_TX_STAT_ACK | IEEE80211_TX_STAT_TX_FILTERED);
+		info->flags &= ~(IEEE80211_TX_STAT_ACK |
+				 IEEE80211_TX_STAT_TX_FILTERED);
 
 		/* inform mac80211 about what happened with the frame */
 		switch (status & TX_STATUS_MSK) {
@@ -1149,10 +1150,11 @@ void iwl_mld_handle_tx_resp_notif(struct iwl_mld *mld,
 			ieee80211_tx_status_skb(mld->hw, skb);
 	}
 
-	IWL_DEBUG_TX_REPLY(mld,
-			   "TXQ %d status 0x%08x ssn=%d initial_rate 0x%x retries %d\n",
-			   txq_id, status, ssn, le32_to_cpu(tx_resp->initial_rate),
-			   tx_resp->failure_frame);
+	IWL_DEBUG_TX_REPLY(
+		mld,
+		"TXQ %d status 0x%08x ssn=%d initial_rate 0x%x retries %d\n",
+		txq_id, status, ssn, le32_to_cpu(tx_resp->initial_rate),
+		tx_resp->failure_frame);
 
 	if (tx_failure && mgmt)
 		iwl_mld_toggle_tx_ant(mld, &mld->mgmt_tx_ant);
@@ -1168,9 +1170,8 @@ void iwl_mld_handle_tx_resp_notif(struct iwl_mld *mld,
 		/* This can happen if the TX cmd was sent before pre_rcu_remove
 		 * but the TX response was received after
 		 */
-		IWL_DEBUG_TX_REPLY(mld,
-				   "Got valid sta_id (%d) but sta is NULL\n",
-				   sta_id);
+		IWL_DEBUG_TX_REPLY(
+			mld, "Got valid sta_id (%d) but sta is NULL\n", sta_id);
 		goto out;
 	}
 
@@ -1246,8 +1247,7 @@ int iwl_mld_flush_link_sta_txqs(struct iwl_mld *mld, u32 fw_sta_id)
 
 	resp_len = iwl_rx_packet_payload_len(cmd.resp_pkt);
 	if (IWL_FW_CHECK(mld, resp_len != sizeof(*rsp),
-			 "Invalid TXPATH_FLUSH response len: %d\n",
-			 resp_len)) {
+			 "Invalid TXPATH_FLUSH response len: %d\n", resp_len)) {
 		ret = -EIO;
 		goto free_rsp;
 	}
@@ -1273,16 +1273,14 @@ int iwl_mld_flush_link_sta_txqs(struct iwl_mld *mld, u32 fw_sta_id)
 		int read_after = le16_to_cpu(queue_info->read_after_flush);
 		int txq_id = le16_to_cpu(queue_info->queue_num);
 
-		if (IWL_FW_CHECK(mld,
-				 txq_id >= ARRAY_SIZE(mld->fw_id_to_txq),
+		if (IWL_FW_CHECK(mld, txq_id >= ARRAY_SIZE(mld->fw_id_to_txq),
 				 "Invalid txq id %d\n", txq_id))
 			continue;
 
-		IWL_DEBUG_TX_QUEUES(mld,
-				    "tid %d txq_id %d read-before %d read-after %d\n",
-				    le16_to_cpu(queue_info->tid), txq_id,
-				    le16_to_cpu(queue_info->read_before_flush),
-				    read_after);
+		IWL_DEBUG_TX_QUEUES(
+			mld, "tid %d txq_id %d read-before %d read-after %d\n",
+			le16_to_cpu(queue_info->tid), txq_id,
+			le16_to_cpu(queue_info->read_before_flush), read_after);
 
 		iwl_mld_tx_reclaim_txq(mld, txq_id, read_after, true);
 	}
@@ -1312,8 +1310,7 @@ int iwl_mld_ensure_queue(struct iwl_mld *mld, struct ieee80211_txq *txq)
 	return ret;
 }
 
-int iwl_mld_update_sta_txqs(struct iwl_mld *mld,
-			    struct ieee80211_sta *sta,
+int iwl_mld_update_sta_txqs(struct iwl_mld *mld, struct ieee80211_sta *sta,
 			    u32 old_sta_mask, u32 new_sta_mask)
 {
 	struct iwl_scd_queue_cfg_cmd cmd = {
@@ -1326,10 +1323,9 @@ int iwl_mld_update_sta_txqs(struct iwl_mld *mld,
 
 	for (int tid = 0; tid <= IWL_MAX_TID_COUNT; tid++) {
 		struct ieee80211_txq *txq =
-			sta->txq[tid != IWL_MAX_TID_COUNT ?
-					tid : IEEE80211_NUM_TIDS];
-		struct iwl_mld_txq *mld_txq =
-			iwl_mld_txq_from_mac80211(txq);
+			sta->txq[tid != IWL_MAX_TID_COUNT ? tid :
+							    IEEE80211_NUM_TIDS];
+		struct iwl_mld_txq *mld_txq = iwl_mld_txq_from_mac80211(txq);
 		int ret;
 
 		if (!mld_txq->status.allocated)
@@ -1340,10 +1336,9 @@ int iwl_mld_update_sta_txqs(struct iwl_mld *mld,
 		else
 			cmd.u.modify.tid = cpu_to_le32(tid);
 
-		ret = iwl_mld_send_cmd_pdu(mld,
-					   WIDE_ID(DATA_PATH_GROUP,
-						   SCD_QUEUE_CONFIG_CMD),
-					   &cmd);
+		ret = iwl_mld_send_cmd_pdu(
+			mld, WIDE_ID(DATA_PATH_GROUP, SCD_QUEUE_CONFIG_CMD),
+			&cmd);
 		if (ret)
 			return ret;
 	}
@@ -1360,27 +1355,32 @@ void iwl_mld_handle_compressed_ba_notif(struct iwl_mld *mld,
 	u8 sta_id = ba_res->sta_id;
 	struct ieee80211_link_sta *link_sta;
 
+	if (unlikely(test_bit(STATUS_FW_ERROR, &mld->trans->status))) {
+		WARN_ONCE(1, "iwlwifi: BA notif (sta=%d) after FW error\n",
+			  sta_id);
+		return;
+	}
+
 	if (!tfd_cnt)
 		return;
 
 	if (IWL_FW_CHECK(mld, struct_size(ba_res, tfd, tfd_cnt) > pkt_len,
-			 "Short BA notif (tfd_cnt=%d, size:0x%x)\n",
-			 tfd_cnt, pkt_len))
+			 "Short BA notif (tfd_cnt=%d, size:0x%x)\n", tfd_cnt,
+			 pkt_len))
 		return;
 
-	IWL_DEBUG_TX_REPLY(mld,
-			   "BA notif received from sta_id=%d, flags=0x%x, sent:%d, acked:%d\n",
-			   sta_id, le32_to_cpu(ba_res->flags),
-			   le16_to_cpu(ba_res->txed),
-			   le16_to_cpu(ba_res->done));
+	IWL_DEBUG_TX_REPLY(
+		mld,
+		"BA notif received from sta_id=%d, flags=0x%x, sent:%d, acked:%d\n",
+		sta_id, le32_to_cpu(ba_res->flags), le16_to_cpu(ba_res->txed),
+		le16_to_cpu(ba_res->done));
 
 	for (int i = 0; i < tfd_cnt; i++) {
 		struct iwl_compressed_ba_tfd *ba_tfd = &ba_res->tfd[i];
 		int txq_id = le16_to_cpu(ba_tfd->q_num);
 		int index = le16_to_cpu(ba_tfd->tfd_index);
 
-		if (IWL_FW_CHECK(mld,
-				 txq_id >= ARRAY_SIZE(mld->fw_id_to_txq),
+		if (IWL_FW_CHECK(mld, txq_id >= ARRAY_SIZE(mld->fw_id_to_txq),
 				 "Invalid txq id %d\n", txq_id))
 			continue;
 
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/rx.c +172 -165

706 lines not on this page · raw message

Signature · 1 line
2.52.0
#2 lore raw

PATCH v2 2/3 wifi: iwlwifi: mld: fix TSO segmentation explosion when AMSDU is disabled

In reply to Cole Leavitt

When the TLC notification disables AMSDU for a TID, the MLD driver sets max_tid_amsdu_len to the sentinel value 1. The TSO segmentation path in iwl_mld_tx_tso_segment() checks for zero but not for this sentinel, allowing it to reach the num_subframes calculation:

num_subframes = (max_tid_amsdu_len + pad) / (subf_len + pad)

                = (1 + 2) / (1534 + 2) = 0

This zero propagates to iwl_tx_tso_segment() which sets:

gso_size = num_subframes * mss = 0

Calling skb_gso_segment() with gso_size=0 creates over 32000 tiny segments from a single GSO skb. This floods the TX ring with ~1024 micro-frames (the rest are purged), creating a massive burst of TX completion events that can lead to memory corruption and a subsequent use-after-free in TCP's retransmit queue (refcount underflow in tcp_shifted_skb, NULL deref in tcp_rack_detect_loss).

The MVM driver is immune because it checks mvmsta->amsdu_enabled before reaching the num_subframes calculation. The MLD driver has no equivalent bitmap check and relies solely on max_tid_amsdu_len, which does not catch the sentinel value.

Fix this by detecting the sentinel value (max_tid_amsdu_len == 1) at the existing check and falling back to non-AMSDU TSO segmentation. Also add a WARN_ON_ONCE guard after the num_subframes division as defense-in-depth to catch any future code paths that produce zero through a different mechanism.

Fixes d1e879ec600f ("wifi: iwlwifi: add iwlmld sub-driver")
---
 drivers/net/wireless/intel/iwlwifi/mld/tx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mld/tx.c +4 -1
index e341d12e5233..8af58aabcd68 100644
@@ -823,7 +823,7 @@ static int iwl_mld_tx_tso_segment(struct iwl_mld *mld, struct sk_buff *skb,
 		return -EINVAL;
 
 	max_tid_amsdu_len = sta->cur->max_tid_amsdu_len[tid];
-	if (!max_tid_amsdu_len)
+	if (!max_tid_amsdu_len || max_tid_amsdu_len == 1)
 		return iwl_tx_tso_segment(skb, 1, netdev_flags, mpdus_skbs);
 
 	/* Sub frame header + SNAP + IP header + TCP header + MSS */
@@ -835,6 +835,9 @@ static int iwl_mld_tx_tso_segment(struct iwl_mld *mld, struct sk_buff *skb,
 	 */
 	num_subframes = (max_tid_amsdu_len + pad) / (subf_len + pad);
 
+	if (WARN_ON_ONCE(!num_subframes))
+		return iwl_tx_tso_segment(skb, 1, netdev_flags, mpdus_skbs);
+
 	if (sta->max_amsdu_subframes &&
 	    num_subframes > sta->max_amsdu_subframes)
 		num_subframes = sta->max_amsdu_subframes;
Signature · 1 line
2.52.0
#3 lore raw

RE: [PATCH 2/3] wifi: iwlwifi: mld: fix TSO segmentation explosion when AMSDU is disabled

Quoted 22 lines

-----Original Message-----
From: Cole Leavitt <[email protected]>
Sent: Sunday, April 5, 2026 8:42 AM
To: [email protected]
Cc: [email protected]; Korenblit, Miriam Rachel <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 2/3] wifi: iwlwifi: mld: fix TSO segmentation explosion when AMSDU is disabled

When the TLC notification disables AMSDU for a TID, the MLD driver sets max_tid_amsdu_len to the sentinel value 1. The TSO segmentation path in iwl_mld_tx_tso_segment() checks for zero but not for this sentinel, allowing it to reach the num_subframes calculation:

num_subframes = (max_tid_amsdu_len + pad) / (subf_len + pad)

                = (1 + 2) / (1534 + 2) = 0

This zero propagates to iwl_tx_tso_segment() which sets:

Quoted 7 lines

gso_size = num_subframes * mss = 0

Calling skb_gso_segment() with gso_size=0 creates over 32000 tiny segments from a single GSO skb. This floods the TX ring with ~1024 micro-frames (the rest are purged), creating a massive burst of TX completion events that can lead to memory corruption and a subsequent use-after-free in TCP's retransmit queue (refcount underflow in tcp_shifted_skb, NULL deref in tcp_rack_detect_loss).

And why not fixing this issue?

Quoted 46 lines

The MVM driver is immune because it checks mvmsta->amsdu_enabled before reaching the num_subframes calculation. The MLD driver has no equivalent bitmap check and relies solely on max_tid_amsdu_len, which does not catch the sentinel value.

Fix this by detecting the sentinel value (max_tid_amsdu_len == 1) at the existing check and falling back to non-AMSDU TSO segmentation. Also add a WARN_ON_ONCE guard after the num_subframes division as defense-in-depth to catch any future code paths that produce zero through a different mechanism.

Fixes d1e879ec600f ("wifi: iwlwifi: add iwlmld sub-driver")
---
 drivers/net/wireless/intel/iwlwifi/mld/tx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mld/tx.c +1 -1
index e341d12e5233..8af58aabcd68 100644
@@ -823,7 +823,7 @@ static int iwl_mld_tx_tso_segment(struct iwl_mld *mld,
 struct sk_buff *skb,
 		return -EINVAL;
 
 	max_tid_amsdu_len = sta->cur->max_tid_amsdu_len[tid];
-	if (!max_tid_amsdu_len)
+	if (!max_tid_amsdu_len || max_tid_amsdu_len == 1)
 		return iwl_tx_tso_segment(skb, 1, netdev_flags, mpdus_skbs);
 

/* Sub frame header + SNAP + IP header + TCP header + MSS */ @@ -
835,6 +835,9 @@ static int iwl_mld_tx_tso_segment(struct iwl_mld *mld, struct sk_buff *skb,

drivers/net/wireless/intel/iwlwifi/mld/tx.c +3 -1
 	 */
 	num_subframes = (max_tid_amsdu_len + pad) / (subf_len + pad);
 
+	if (WARN_ON_ONCE(!num_subframes))
+		return iwl_tx_tso_segment(skb, 1, netdev_flags, mpdus_skbs);
+
 	if (sta->max_amsdu_subframes &&
 	    num_subframes > sta->max_amsdu_subframes)
 		num_subframes = sta->max_amsdu_subframes;
--

2.52.0

#4 lore raw

Re: [PATCH 2/3] wifi: iwlwifi: mld: fix TSO segmentation explosion when AMSDU is disabled

Quoted 24 lines · Miriam Rachel
Quoted 24 lines

-----Original Message-----
From: Cole Leavitt <[email protected]>
Sent: Sunday, April 5, 2026 8:42 AM
To: [email protected]
Cc: [email protected]; Korenblit, Miriam Rachel <[email protected]>; [email protected]; [email protected]
Subject: [PATCH 2/3] wifi: iwlwifi: mld: fix TSO segmentation explosion when AMSDU is disabled

When the TLC notification disables AMSDU for a TID, the MLD driver sets max_tid_amsdu_len to the sentinel value 1. The TSO segmentation path in iwl_mld_tx_tso_segment() checks for zero but not for this sentinel, allowing it to reach the num_subframes calculation:

num_subframes = (max_tid_amsdu_len + pad) / (subf_len + pad)

                 = (1 + 2) / (1534 + 2) = 0

This zero propagates to iwl_tx_tso_segment() which sets:

gso_size = num_subframes * mss = 0

Quoted 7 lines
Quoted 5 lines

Calling skb_gso_segment() with gso_size=0 creates over 32000 tiny segments from a single GSO skb. This floods the TX ring with ~1024 micro-frames (the rest are purged), creating a massive burst of TX completion events that can lead to memory corruption and a subsequent use-after-free in TCP's retransmit queue (refcount underflow in tcp_shifted_skb, NULL deref in tcp_rack_detect_loss).

And why not fixing this issue?

We have been running with this patch. It doesn't seem to cause harm, but also, we still saw at least a few warnings about 32k spins in GSO logic.

I am pretty sure the 32k GSO spin we see is due to some skb memory corruption of some kind, and I don't know root cause.

Maybe this patch is still worth having, but the description about lots of tx completion events causing mem corruption seems unfounded to me, and while I have no proof, this sort of over-confidence in cause vs affect appears similar to some other AI generated patches I've seen.

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#5 lore raw

PATCH v2 3/3 wifi: iwlwifi: mld: skip TX when firmware is dead

In reply to Cole Leavitt

When firmware encounters an error, STATUS_FW_ERROR is set but the mac80211 TX path continues pulling frames from TXQs. Each frame fails at iwl_trans_tx() which checks STATUS_FW_ERROR and returns -EIO, but iwl_mld_tx_from_txq() keeps looping over every queued frame. This burns CPU in a tight loop on dead firmware and can cause soft lockups during firmware error recovery.

Add a STATUS_FW_ERROR check at the top of iwl_mld_tx_from_txq() to stop pulling frames from mac80211 TXQs when firmware is dead. Also guard iwl_mld_mac80211_tx() which bypasses the TXQ path entirely and would otherwise continue feeding frames to dead firmware.

Once STATUS_FW_ERROR is cleared during firmware restart, TX resumes naturally with no explicit wake needed.

Fixes d1e879ec600f ("wifi: iwlwifi: add iwlmld sub-driver")
---
 drivers/net/wireless/intel/iwlwifi/mld/mac80211.c | 4 ++++
 drivers/net/wireless/intel/iwlwifi/mld/tx.c       | 3 +++
 2 files changed, 7 insertions(+)
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c +4 -0
index 71a9a72c9ac0..0df3be3089c3 100644
@@ -519,6 +519,10 @@ iwl_mld_mac80211_tx(struct ieee80211_hw *hw,
 	u32 link_id = u32_get_bits(info->control.flags,
 				   IEEE80211_TX_CTRL_MLO_LINK);
 
+	if (unlikely(test_bit(STATUS_FW_ERROR, &mld->trans->status))) {
+		ieee80211_free_txskb(hw, skb);
+		return;
+	}
 	/* In AP mode, mgmt frames are sent on the bcast station,
 	 * so the FW can't translate the MLD addr to the link addr. Do it here
 	 */
drivers/net/wireless/intel/iwlwifi/mld/tx.c +3 -0
index 8af58aabcd68..33bd2e336166 100644
@@ -962,6 +962,9 @@ void iwl_mld_tx_from_txq(struct iwl_mld *mld, struct ieee80211_txq *txq)
 	struct sk_buff *skb = NULL;
 	u8 zero_addr[ETH_ALEN] = {};
 
+	if (unlikely(test_bit(STATUS_FW_ERROR, &mld->trans->status)))
+		return;
+
 	/*
 	 * No need for threads to be pending here, they can leave the first
 	 * taker all the work.
Signature · 1 line
2.52.0
#6 lore raw
In reply to Cole Leavitt
Quoted 28 lines

-----Original Message-----
From: Cole Leavitt <[email protected]>
Sent: Sunday, April 5, 2026 8:42 AM
To: [email protected]
Cc: [email protected]; Korenblit, Miriam Rachel <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v2 0/3] wifi: iwlwifi: mld: fix UAF and soft lockup on firmware error

Three fixes for the iwlmld sub-driver addressing use-after-free, TSO segmentation explosion, and soft lockups during firmware error recovery on Intel BE200 (WiFi7).

1/3 closes the NAPI race window where stale RX data from dying firmware reaches the TX completion handlers, causing corrupt SSN values to trigger skb use-after-free in iwl_trans_reclaim().
Ben Greear confirmed the WARN_ONCE fires on his test systems.

2/3 fixes the TSO segmentation explosion when AMSDU is disabled for a TID. The TLC notification sets max_tid_amsdu_len to the sentinel value 1, which slips past the existing zero check and produces num_subframes=0, causing skb_gso_segment() to create
32000+ tiny segments. Revised per Miriam Korenblit's feedback to check for the sentinel value directly and add a WARN_ON_ONCE guard after the division as defense-in-depth.

Quoted 4 lines

3/3 adds STATUS_FW_ERROR checks in the TX pull path to stop feeding frames to dead firmware. Revised per Johannes Berg's feedback to use status bit checks instead of stop_queues/wake_queues, which doesn't interact well with TXQ- based APIs.

Was the soft lockup happening after (as a consequence?) of the bug that you fixed in 2/3? I am wondering why we didn't see it in mvm driver. I don't think we have such a guard there

Quoted 24 lines

Changes since v1:
- 1/3: Added Tested-by from Ben Greear
- 2/3: Check max_tid_amsdu_len == 1 (sentinel) instead of guarding !num_subframes after division; added WARN_ON_ONCE defense-in-depth (Suggested-by: Miriam Korenblit)
- 3/3: Replaced ieee80211_stop_queues()/wake_queues() with STATUS_FW_ERROR checks in TX pull path (per Johannes Berg)

Cole Leavitt (3):
wifi: iwlwifi: prevent NAPI processing after firmware error
wifi: iwlwifi: mld: fix TSO segmentation explosion when AMSDU is
disabled
wifi: iwlwifi: mld: skip TX when firmware is dead

 .../net/wireless/intel/iwlwifi/mld/mac80211.c |   4 +
 drivers/net/wireless/intel/iwlwifi/mld/tx.c   | 210 +++++------
 .../wireless/intel/iwlwifi/pcie/gen1_2/rx.c   | 337 +++++++++---------
 3 files changed, 284 insertions(+), 267 deletions(-)

base-commit: 3aae9383f42f687221c011d7ee87529398e826b3 --
2.52.0

A message that is not in the archive (sent off-list or not yet received): DS0PR11MB7880A8ABB08B6CD3DA5EB53EA3222@DS0PR11MB7880.namprd11.prod.outlook.com

#8 lore raw

Miriam,

Answering both of your questions in one reply.

Quoted 1 line

Any chance you can share the dmesg that includes also the FW error?

Yes — trimmed the boot noise down to the relevant window. On BE200 running c102 firmware (iwlwifi-gl-c0-fm-c0-c102.ucode, build 102.07fca168.0) the sequence looks like this:

iwlwifi 0000:84:00.0: Error sending SYSTEM_STATISTICS_CMD: time out after 2000ms. iwlwifi 0000:84:00.0: Failed to send the temperature measurement command (err=-110) iwlwifi 0000:84:00.0: Start IWL Error Log Dump:
iwlwifi 0000:84:00.0: Loaded firmware version: 102.07fca168.0 gl-c0-fm-c0-c102.ucode

  iwlwifi 0000:84:00.0: 0x00000070 | NMI_INTERRUPT_UNKNOWN
  iwlwifi 0000:84:00.0: 0x00000B03 | branchlink2
  iwlwifi 0000:84:00.0: 0x67A00000 | FSEQ_ERROR_CODE
  iwlwifi 0000:84:00.0: UMAC CURRENT PC: 0xc00863c0
  iwlwifi 0000:84:00.0: UMAC CURRENT PC 1: 0xc00863c2
  iwlwifi 0000:84:00.0: LMAC1 CURRENT PC: 0xd0
  iwlwifi 0000:84:00.0: LMAC2 CURRENT PC: 0xd0
  iwlwifi 0000:84:00.0: Device error - SW reset
  ...
  watchdog: BUG: soft lockup - CPU#4 stuck for 26s! [ssh:2761085]
  watchdog: BUG: soft lockup - CPU#6 stuck for 26s! [irq/261-iwlwifi:1632]
  watchdog: BUG: soft lockup - CPU#21 stuck for 23s! [Chrome_ChildIOT:843039]

Backtraces on the stuck CPUs converge on native_queued_spin_lock_slowpath -> __dev_queue_xmit -> validate_xmit_skb -> skb_segment (on the ssh:* threads) and on the iwlwifi IRQ threads ieee80211_queue_skb -> codel_dequeue.

The full multi-boot capture (~2k lines) is attached off-list to avoid spamming linux-wireless; happy to send it to you directly or upload it somewhere convenient for the Intel firmware team.

One detail I think is useful for internal investigation: I extracted the code sections of the c102 .ucode file and disassembled the UMAC image around 0xc00863c0. With Code Density enabled the CRASH PC sits in a sequence of three consecutive narrow L32I.N instructions all reading the same offset:

  c00863bd:  78 e0      l32i.n  a7, a0, 56
  c00863bf:  78 e0      l32i.n  a7, a0, 56    ; crash PC falls here
  c00863c1:  78 e0      l32i.n  a7, a0, 56
  c00863c3:  78 8c      l32i.n  a7, a12, 32

Looks like a tight MMIO poll waiting on a ready bit after the malformed AMSDU descriptor sequence is queued — the SYSTEM_STATISTICS timeout fires 2 seconds later because the firmware never leaves that loop. If it's useful, I have the full ELF of the extracted firmware image (load addresses preserved) ready to share.

Quoted 2 lines

Was the soft lockup happening after (as a consequence?) of the bug that you fixed in 2/3?

Yes, chained. The typical reproduction trace is:

1. 2/3: TLC disables AMSDU for a TID, max_tid_amsdu_len=1 sentinel, the missing-sentinel check lets num_subframes=0 through, skb_gso_segment() expands the skb into an unbounded number of tiny segments.
2. Firmware receives the malformed AMSDU descriptor chain and hangs

     in the MMIO poll above (FSEQ_ERROR_CODE 0x67A00000,
     SYSTEM_STATISTICS_CMD timeout).

3. 3/3: mac80211 TX continues pulling from the TXQs while STATUS_FW_ERROR is set, iwl_mld_tx_from_txq() loops over every queued frame, each fails at iwl_trans_tx() with -EIO — soft lockup watchdog fires on whichever CPU is pulling the queue.
4. 1/3: NAPI keeps draining stale RX from the dying firmware into iwl_mld_handle_tx_resp_notif(). iwl_trans_reclaim() already early-returns on STATUS_FW_ERROR so a real UAF can't reach the queue walk from there; 1/3's WARN_ONCE guards are really instrumentation so that if the post-FW-error race does fire we get a log line rather than silent CPU burn.

So 2/3 is the root-cause driver fix, 3/3 eliminates the soft lockup that 2/3's trigger would otherwise produce, and 1/3 closes an earlier observation window for diagnostics. They come as a series because all three fired together in Ben's and my reproductions, but 3/3 can stand alone if you prefer.

Quoted 2 lines

I am wondering why we didn't see it in mvm driver. I don't think we have such a guard there.

MVM gates AMSDU at a different layer — in mvm/tx.c lines 910-913 and 934-937, mvmsta->amsdu_enabled (a per-TID bitmap) is checked before the num_subframes calculation ever runs. When AMSDU is disabled for a TID in MVM, the bitmap bit is cleared and TSO falls through to the non-AMSDU path immediately. MLD has no equivalent bitmap; it relies only on max_tid_amsdu_len and trusts the "== 0 means disabled" convention — but the TLC notification path actually writes the sentinel 1 (mld/tlc.c:858 and the MVM equivalents at mvm/rs-fw.c:497, mvm/rs.c:1529), so MLD should also treat that value as disabled. That's what 2/3 does.

v3 is prepared and will be out shortly. Changes from v2:

- 1/3: commit message reframed — the v2 text claimed a proven SSN-corruption -> iwl_trans_reclaim() UAF chain, but reclaim already checks STATUS_FW_ERROR itself, so that chain cannot actually reach the queue walk. The patch is more accurately described as earlier guards with WARN_ONCE instrumentation, which is what it actually is. Also stripped about 1100 lines of inadvertent clang-format style churn that snuck into v2.
- 2/3: Removed the speculative tcp_shifted_skb / tcp_rack_detect_loss causal chain from the commit message per Ben's feedback. The driver-side bug is traced in-tree; the downstream TCP symptom attribution is being investigated separately with Ben and is not claimed here.
- 3/3: Unchanged from v2.

Thanks for the review.

Cole