Linux wireless drivers development
 help / color / mirror / Atom feed
From: Maoyi Xie <maoyixie.tju@gmail.com>
To: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH iwlwifi-next 1/4] wifi: iwlwifi: mvm: validate TID in TX response handlers
Date: Wed, 25 Nov 2026 16:37:39 +0800	[thread overview]
Message-ID: <20261125083742.1355074-2-maoyixie.tju@gmail.com> (raw)
In-Reply-To: <20261125083742.1355074-1-maoyixie.tju@gmail.com>

iwl_mvm_rx_tx_cmd_single() and iwl_mvm_rx_tx_cmd_agg() index
mvmsta->tid_data[] with the 4-bit TID from ra_tid. Only the first
function skips IWL_MGMT_TID. A TID above 8 writes to the members that
follow the array.

Add the check that iwl_mvm_rx_ba_notif() has.

Found with a CodeQL-based static analysis tool.
Reproduced in a userspace harness under UBSan. Not tested on hardware.

Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
---
I used an LLM to help write the harness and this patch.

 drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index d3c2fe830477..d06ce3d1eb68 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -1731,7 +1731,9 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
 		    mvmsta->sta_state < IEEE80211_STA_AUTHORIZED)
 			iwl_mvm_toggle_tx_ant(mvm, &mvmsta->tx_ant);
 
-		if (sta->wme && tid != IWL_MGMT_TID) {
+		if (sta->wme && tid != IWL_MGMT_TID &&
+		    !IWL_FW_CHECK(mvm, tid >= ARRAY_SIZE(mvmsta->tid_data),
+				  "invalid TID %d in TX response\n", tid)) {
 			struct iwl_mvm_tid_data *tid_data =
 				&mvmsta->tid_data[tid];
 			bool send_eosp_ndp = false;
@@ -1865,6 +1867,10 @@ static void iwl_mvm_rx_tx_cmd_agg(struct iwl_mvm *mvm,
 			 (queue != IWL_MVM_DQA_BSS_CLIENT_QUEUE)))
 		return;
 
+	if (IWL_FW_CHECK(mvm, tid >= ARRAY_SIZE(mvmsta->tid_data),
+			 "invalid TID %d in agg TX response\n", tid))
+		return;
+
 	iwl_mvm_rx_tx_cmd_agg_dbg(mvm, pkt);
 
 	rcu_read_lock();
-- 
2.34.1


  reply	other threads:[~2026-11-25  8:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  8:37 [PATCH iwlwifi-next 0/4] wifi: iwlwifi: validate more indices from the firmware Maoyi Xie
2026-11-25  8:37 ` Maoyi Xie [this message]
2026-11-25  8:37 ` [PATCH iwlwifi-next 2/4] wifi: iwlwifi: mvm: validate BAID in the RX path Maoyi Xie
2026-11-25  8:37 ` [PATCH iwlwifi-next 3/4] wifi: iwlwifi: mld: validate BAID in the RX timestamp update Maoyi Xie
2026-11-25  8:37 ` [PATCH iwlwifi-next 4/4] wifi: iwlwifi: pcie: validate txq_id in reclaim Maoyi Xie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125083742.1355074-2-maoyixie.tju@gmail.com \
    --to=maoyixie.tju@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=miriam.rachel.korenblit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox