Skip to content

Commit 92cee08

Browse files
coleleavittMiriam-Rachel
authored andcommitted
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 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. Suggested-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com> Fixes: d1e879e ("wifi: iwlwifi: add iwlmld sub-driver") Signed-off-by: Cole Leavitt <cole@unwrap.rs> Link: https://patch.msgid.link/20260405054145.1064152-3-cole@unwrap.rs Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
1 parent 7666dbb commit 92cee08

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • drivers/net/wireless/intel/iwlwifi/mld

drivers/net/wireless/intel/iwlwifi/mld/tx.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ static int iwl_mld_tx_tso_segment(struct iwl_mld *mld, struct sk_buff *skb,
834834
return -EINVAL;
835835

836836
max_tid_amsdu_len = sta->cur->max_tid_amsdu_len[tid];
837-
if (!max_tid_amsdu_len)
837+
if (!max_tid_amsdu_len || max_tid_amsdu_len == 1)
838838
return iwl_tx_tso_segment(skb, 1, netdev_flags, mpdus_skbs);
839839

840840
/* Sub frame header + SNAP + IP header + TCP header + MSS */
@@ -846,6 +846,9 @@ static int iwl_mld_tx_tso_segment(struct iwl_mld *mld, struct sk_buff *skb,
846846
*/
847847
num_subframes = (max_tid_amsdu_len + pad) / (subf_len + pad);
848848

849+
if (WARN_ON_ONCE(!num_subframes))
850+
return iwl_tx_tso_segment(skb, 1, netdev_flags, mpdus_skbs);
851+
849852
if (sta->max_amsdu_subframes &&
850853
num_subframes > sta->max_amsdu_subframes)
851854
num_subframes = sta->max_amsdu_subframes;

0 commit comments

Comments
 (0)