Skip to contentSkip to conversation

wifi: nxpwifi: fix two block ack teardown bugs

PATCH New David Carlier 1 participant 3 messages Aug 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover wifi: nxpwifi: fix two block ack teardown bugs

Two independent bugs in the block ack teardown paths, both found by code inspection on next-20260825 and compile tested only.

The first leaves nxpwifi_11n_delete_tx_ba_stream_tbl_entry() unable to delete anything, so Tx BA stream entries leak on every teardown and aggregation eventually stops being negotiated. The second holds the RCU read lock across a teardown that sleeps, which splats under CONFIG_DEBUG_ATOMIC_SLEEP when a station deauthenticates from the AP.

David Carlier (2):
wifi: nxpwifi: fix inverted check in Tx BA stream entry deletion
wifi: nxpwifi: do not delete Rx reorder entries under RCU

 drivers/net/wireless/nxp/nxpwifi/11n.c           |  2 +-
 drivers/net/wireless/nxp/nxpwifi/11n_rxreorder.c | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)
Signature · 1 line
2.55.0
#1 lore raw

PATCH 1/2 wifi: nxpwifi: fix inverted check in Tx BA stream entry deletion

nxpwifi_is_tx_ba_stream_ptr_valid() returns true when the entry is still linked, and every caller passes an entry that is on the list, so the early return always fires and nothing is ever unlinked or freed. Entries leak on every teardown and, since nxpwifi_space_avail_for_new_ba_stream() counts them, Tx aggregation stops being negotiated once the stale count reaches the maximum.

Changing the original dead && test to || to silence a NULL dereference report inverted the validity test along with it.

Fixes 00c786a7581e ("wifi: nxpwifi: fix multiple static analysis errors and warnings")
Assisted-by Claude:claude-opus-5
---
 drivers/net/wireless/nxp/nxpwifi/11n.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/nxp/nxpwifi/11n.c +1 -1
index c2a54d781b42..25b2e430f3f9 100644
@@ -451,7 +451,7 @@ void
 nxpwifi_11n_delete_tx_ba_stream_tbl_entry(struct nxpwifi_private *priv,
 					  struct nxpwifi_tx_ba_stream_tbl *tbl)
 {
-	if (!tbl || nxpwifi_is_tx_ba_stream_ptr_valid(priv, tbl))
+	if (!tbl || !nxpwifi_is_tx_ba_stream_ptr_valid(priv, tbl))
 		return;
 
 	nxpwifi_dbg(priv->adapter, INFO,
Signature · 1 line
2.55.0
#2 lore raw

PATCH 2/2 wifi: nxpwifi: do not delete Rx reorder entries under RCU

In reply to David Carlier

The RCU guard is declared in the body of the per-TID loop, so it is still held across the teardown pass. nxpwifi_del_rx_reorder_entry() flushes the Rx workqueue and deletes the reorder timer synchronously, both of which sleep, so a station deauthenticating from the AP splats under CONFIG_DEBUG_ATOMIC_SLEEP.

Scope the guard to the collection walk. The teardown does not need RCU: it serialises on priv->rx_reorder_tbl_lock[] and frees with kfree_rcu().

Fixes 73b01e57ed3e ("wifi: nxp: add nxpwifi driver for IW61x")
Assisted-by Claude:claude-opus-5
---
 drivers/net/wireless/nxp/nxpwifi/11n_rxreorder.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/wireless/nxp/nxpwifi/11n_rxreorder.c +6 -5
index 65b628411543..87cf2ec85991 100644
@@ -205,11 +205,12 @@ void nxpwifi_11n_del_rx_reorder_tbl_by_ta(struct nxpwifi_private *priv, u8 *ta)
 		return;
 
 	for (i = 0; i < MAX_NUM_TID; i++) {
-		guard(rcu)();
-		list_for_each_entry_rcu(tbl, &priv->rx_reorder_tbl_ptr[i], list) {
-			if (!memcmp(tbl->ta, ta, ETH_ALEN)) {
-				INIT_LIST_HEAD(&tbl->tmp_list);
-				list_add_tail(&tbl->tmp_list, &to_delete);
+		scoped_guard(rcu) {
+			list_for_each_entry_rcu(tbl, &priv->rx_reorder_tbl_ptr[i], list) {
+				if (!memcmp(tbl->ta, ta, ETH_ALEN)) {
+					INIT_LIST_HEAD(&tbl->tmp_list);
+					list_add_tail(&tbl->tmp_list, &to_delete);
+				}
 			}
 		}
 
Signature · 1 line
2.55.0