[PATCH] wifi: nxpwifi: validate TID in ADDBA and DELBA command responses
From: luoyifan
Date: Mon Nov 16 2026 - 20:43:33 EST
From: Luo Yifan <luoyifan@xxxxxxxxxxxxxxxxxxxx>
The TID field in ADDBA and DELBA management frames is four bits wide, so a
peer can put any value in the range 0-15 in it. The firmware forwards the
parsed frames to the driver as command responses and events, and
nxpwifi_ret_11n_delba(), nxpwifi_ret_11n_addba_req() and
nxpwifi_11n_delete_ba_stream() use that TID without validating it.
The TID is then used to index arrays that only have MAX_NUM_TID (8)
entries: rx_reorder_tbl_ptr[], rx_reorder_tbl_lock[],
tx_ba_stream_tbl_ptr[], tx_ba_stream_tbl_lock[] and aggr_prio_tbl[]. A
TID in the range 8-15 therefore reads or writes past the end of these
arrays. In particular, nxpwifi_del_ba_tbl() takes a spinlock at
priv->tx_ba_stream_tbl_lock[tid] and nxpwifi_get_ba_tbl() walks a list at
priv->tx_ba_stream_tbl_ptr[tid], so a peer can make the driver operate on
unrelated memory.
Reject out-of-range TIDs at the entry of the three handlers. This covers
the DELBA response, the ADDBA response and the DELBA event paths; the RX
reorder data path has its own checks.
Signed-off-by: Luo Yifan <luoyifan@xxxxxxxxxxxxxxxxxxxx>
---
drivers/net/wireless/nxp/nxpwifi/11n.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/wireless/nxp/nxpwifi/11n.c b/drivers/net/wireless/nxp/nxpwifi/11n.c
index 9eae93c3b8..56aadbb540 100644
--- a/drivers/net/wireless/nxp/nxpwifi/11n.c
+++ b/drivers/net/wireless/nxp/nxpwifi/11n.c
@@ -99,6 +99,12 @@ int nxpwifi_ret_11n_delba(struct nxpwifi_private *priv,
u16 del_ba_param_set = le16_to_cpu(del_ba->del_ba_param_set);
tid = del_ba_param_set >> DELBA_TID_POS;
+ if (tid >= MAX_NUM_TID) {
+ nxpwifi_dbg(priv->adapter, ERROR,
+ "DELBA: invalid tid %d\n", tid);
+ return -EINVAL;
+ }
+
if (del_ba->del_result == BA_RESULT_SUCCESS) {
nxpwifi_del_ba_tbl(priv, tid, del_ba->peer_mac_addr,
TYPE_DELBA_SENT,
@@ -143,6 +149,11 @@ int nxpwifi_ret_11n_addba_req(struct nxpwifi_private *priv,
& SSN_MASK);
tid = u16_get_bits(block_ack_param_set, IEEE80211_ADDBA_PARAM_TID_MASK);
+ if (tid >= MAX_NUM_TID) {
+ nxpwifi_dbg(priv->adapter, ERROR,
+ "ADDBA RSP: invalid tid %d\n", tid);
+ return -EINVAL;
+ }
tid_down = nxpwifi_wmm_downgrade_tid(priv, tid);
ra_list = nxpwifi_wmm_get_ralist_node(priv, tid_down,
@@ -626,6 +637,11 @@ void nxpwifi_11n_delete_ba_stream(struct nxpwifi_private *priv, u8 *del_ba)
int tid;
tid = del_ba_param_set >> DELBA_TID_POS;
+ if (tid >= MAX_NUM_TID) {
+ nxpwifi_dbg(priv->adapter, ERROR,
+ "DELBA event: invalid tid %d\n", tid);
+ return;
+ }
nxpwifi_del_ba_tbl(priv, tid, cmd_del_ba->peer_mac_addr,
TYPE_DELBA_RECEIVE, INITIATOR_BIT(del_ba_param_set));
--
2.24.4