From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79DB128C037; Sat, 26 Sep 2026 15:49:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790437761; cv=none; b=GmT00n0Uy8WT/OpdEtcjCBhbPxrN+6d+KpujI66K0B8npBe64fbr7Dqs7QGqwM8i1hE/GQU52aoviaMs7910jUFe1lUbwJatF0L2R8Zfxp1RMSezmN1RNU7wcTnpQjDl6k7hqt6GBTDhB6BFeStQ2Xas86T2jo8/Xo9Mgr0LPv0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790437761; c=relaxed/simple; bh=4J4Kg3YuteD9wiFq70DaqkNxo2XjS26NhrcoO4oCEC0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MDmEvVKv0LHII9IURbSD0lA5Mtnx9N8Ar8UE65aRJqUmOCT3bpbHWf05CeLuZxsUqvobavhwlGTKFNScQT8cMPete4dfqFEY6ai5GYj73LrRU5QCTkfqZoJtSXTUNaV4OJ7uTGxyvgfFjiyqDaRrOUgogJQ8lL4UnEvh0GrecRQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=aztHeWkv; arc=none smtp.client-ip=117.135.210.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="aztHeWkv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=j2 74234qXl6Adx9NrOYpzzR9WSPKXvomignRM47Vgdo=; b=aztHeWkv6gCCyd9w15 XuUvdy1SNYmuzbEw+yEhJX/4g6nij3jiPlMfHaS1l7yPiBa19jxkXmAdWuMbJTTH MjebKXhnagdTjP1jk1ASR0C7TZHwLT1wJUoLKdpFbSeKqKr4AW3T8DVkkHg4GLBF LlPvNuGmLEbdk3W89DCSAD5CA= Received: from pc.localdomain (unknown []) by gzga-smtp-mtada-g1-4 (Coremail) with SMTP id _____wD3F4pL6bdqlpIIBA--.11355S5; Sat, 26 Sep 2026 23:48:31 +0800 (CST) From: Jiale Yao To: Jeff Johnson , Pradeep Kumar Chitrapu , Kalle Valo , Sven Eckelmann , Govindaraj Saminathan , Ganesh Sesetti , linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Jiale Yao Subject: [PATCH 3/5] wifi: ath11k: avoid IDR mutation during vif mgmt TX cleanup Date: Sat, 26 Sep 2026 23:48:22 +0800 Message-Id: <20260926154824.75224-4-yaojiale02@163.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260926154824.75224-1-yaojiale02@163.com> References: <20260926154824.75224-1-yaojiale02@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wD3F4pL6bdqlpIIBA--.11355S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7Ar4UtFW8Jry7ZryrWFW5trb_yoW8tF4rpF 47W342yFy8AF47Xr4rCw4rA3WrXas8K39F9r4DG34rJFnFyF1SgFyFvF1avrWrta18GFy2 krWUtr15G34qk3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zR5rchUUUUU= X-CM-SenderInfo: x1dryxhdohiji6rwjhhfrp/xtbC8BAXUWq36VC7YQAA3Y ath11k_mac_op_remove_interface() walks txmgmt_idr with idr_for_each(), and its callback removes each entry belonging to the interface. Removing the current entry can invalidate the radix-tree iterator retained by idr_for_each(). Move the walk into a helper that uses idr_for_each_entry(). It performs a fresh lookup for every iteration, so each matching entry can be removed through the locked removal helper without retaining iterator state across the removal. Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Jiale Yao --- drivers/net/wireless/ath/ath11k/mac.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 696f9dd65ad4..07de423086c9 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6181,16 +6181,18 @@ int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx) return 0; } -static int ath11k_mac_vif_txmgmt_idr_remove(int buf_id, void *skb, void *ctx) +static void ath11k_mac_vif_txmgmt_cleanup(struct ath11k *ar, + struct ieee80211_vif *vif) { - struct ieee80211_vif *vif = ctx; - struct ath11k_skb_cb *skb_cb = ATH11K_SKB_CB((struct sk_buff *)skb); - struct ath11k *ar = skb_cb->ar; - - if (skb_cb->vif == vif) - ath11k_mac_tx_mgmt_free(ar, buf_id); + struct ath11k_skb_cb *skb_cb; + struct sk_buff *skb; + int buf_id; - return 0; + idr_for_each_entry(&ar->txmgmt_idr, skb, buf_id) { + skb_cb = ATH11K_SKB_CB(skb); + if (skb_cb->vif == vif) + ath11k_mac_tx_mgmt_free(ar, buf_id); + } } static int ath11k_mac_mgmt_tx_wmi(struct ath11k *ar, struct ath11k_vif *arvif, @@ -7421,8 +7423,7 @@ static void ath11k_mac_op_remove_interface(struct ieee80211_hw *hw, ath11k_peer_cleanup(ar, arvif->vdev_id); - idr_for_each(&ar->txmgmt_idr, - ath11k_mac_vif_txmgmt_idr_remove, vif); + ath11k_mac_vif_txmgmt_cleanup(ar, vif); for (i = 0; i < ab->hw_params.hal_params->num_tx_rings; i++) { spin_lock_bh(&ab->dp.tx_ring[i].tx_idr_lock); -- 2.34.1