From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.3]) (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 B96643B5841; Sat, 3 Oct 2026 09:21:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.3 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791019300; cv=none; b=tjFyMcURvmTyaMoLy5BVtCZl2X7PqV54u+SogGdxdjon79cOH+dJ6fP0xIK5z1puasjYQYRh2Cgg347lFsUGNE6xhdpsAq8SdKZAv48WRVhq4bK/WmCllakNQ+QxBS3Rt7sOM3PVlUhz2AeCCFe4kwCAwKfsQ+zqSG4D1tW+e4k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791019300; c=relaxed/simple; bh=iWKXjWORE1v5dliSE5q0lASvL5QIKSZ3YlxvIu8Gkvc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Q0wFkmDz9xy4DcabuY0RfxcdbwHsAxafIEznalYoG42uozOMzxsN5wkV/Xrlvr0q6a2wBqODzuhHj/JRpxdblFShorbpWVK5ViLMX2NKxNoDRQC5SeRg3j5Amo9V01TDzlhTzLysd9w2BUCy+QDouD4RLFgF+Q5JGUFgFEJrGKA= 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=DazRDYvZ; arc=none smtp.client-ip=220.197.31.3 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="DazRDYvZ" 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=aK fbK6viYS5HPrJhhIkHWb/Xk1VwHI0VgEEBup0zH+M=; b=DazRDYvZG3o6tEgBYZ rC1RR0AvoA527cRJ/cYmvBV/C1FdLOe+sJrdJsXAE7fGz5A12WkmLZu+lsslKHxN LtbSop9vNGER+qQYDEtmsoNypQaMUy1qh7SkeKaN6m4k6+CXHhP40f8KTvpFam7f ieCKI8eo1l4CPK0QP672Eevlw= Received: from pc.localdomain (unknown []) by gzga-smtp-mtada-g1-3 (Coremail) with SMTP id _____wD3n1YCycBqC7WjCQ--.62376S4; Sat, 03 Oct 2026 17:21:10 +0800 (CST) From: Jiale Yao To: Jeff Johnson , Manikanta Pubbisetty , kbuild test robot , Vasanthakumar Thiagarajan , Maharaja Kennadyrajan , Rajkumar Manoharan , linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Jiale Yao Subject: [PATCH v2 2/5] wifi: ath11k: avoid IDR mutation during pending mgmt TX cleanup Date: Sat, 3 Oct 2026 17:20:59 +0800 Message-Id: <20261003092104.520135-3-yaojiale02@163.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261003092104.520135-1-yaojiale02@163.com> References: <20261003092104.520135-1-yaojiale02@163.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wD3n1YCycBqC7WjCQ--.62376S4 X-Coremail-Antispam: 1Uf129KBjvJXoWxJFyxtw43tFWxJFWfGF1xZrb_yoW5trWUpF W8ua9FyFyUArsrXws5AF4xAFy5X3Z5twsFkr4kC34fXF9FvFnaqF1YvFy3JryYyr4UJFyj vr4Utr15G3s8t3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pK-eoAUUUUU= X-CM-SenderInfo: x1dryxhdohiji6rwjhhfrp/xtbC7wY+eGrAyQYqLAAA3M The pending management TX cleanup walks txmgmt_idr with idr_for_each(), and its callback removes the current entry. This can invalidate the radix-tree iterator retained by idr_for_each(). Use idr_for_each_entry() so every iteration starts with a fresh lookup. Continue to remove each entry under txmgmt_idr_lock before freeing its skb, preventing concurrent TX completion from finding a stale skb pointer. Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Jiale Yao --- drivers/net/wireless/ath/ath11k/core.c | 3 +-- drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++------ drivers/net/wireless/ath/ath11k/mac.h | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index 8039124e7832..31ac17c51036 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -2449,8 +2449,7 @@ void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab) complete(&ar->thermal.wmi_sync); wake_up(&ar->dp.tx_empty_waitq); - idr_for_each(&ar->txmgmt_idr, - ath11k_mac_tx_mgmt_pending_free, ar); + ath11k_mac_tx_mgmt_pending_free(ar); idr_destroy(&ar->txmgmt_idr); wake_up(&ar->txmgmt_empty_waitq); diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index ae91b57c8422..f9af403a2f0d 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6167,13 +6167,13 @@ static void ath11k_mac_tx_mgmt_free(struct ath11k *ar, int buf_id) ath11k_mgmt_over_wmi_tx_drop(ar, msdu); } -int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx) +void ath11k_mac_tx_mgmt_pending_free(struct ath11k *ar) { - struct ath11k *ar = ctx; - - ath11k_mac_tx_mgmt_free(ar, buf_id); + struct sk_buff *msdu; + int buf_id; - return 0; + idr_for_each_entry(&ar->txmgmt_idr, msdu, buf_id) + ath11k_mac_tx_mgmt_free(ar, buf_id); } static int ath11k_mac_vif_txmgmt_idr_remove(int buf_id, void *skb, void *ctx) @@ -10417,7 +10417,7 @@ static void __ath11k_mac_unregister(struct ath11k *ar) ieee80211_unregister_hw(ar->hw); - idr_for_each(&ar->txmgmt_idr, ath11k_mac_tx_mgmt_pending_free, ar); + ath11k_mac_tx_mgmt_pending_free(ar); idr_destroy(&ar->txmgmt_idr); kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels); diff --git a/drivers/net/wireless/ath/ath11k/mac.h b/drivers/net/wireless/ath/ath11k/mac.h index 59f83c7175fd..127cb476b44b 100644 --- a/drivers/net/wireless/ath/ath11k/mac.h +++ b/drivers/net/wireless/ath/ath11k/mac.h @@ -162,7 +162,7 @@ struct ath11k *ath11k_mac_get_ar_by_pdev_id(struct ath11k_base *ab, u32 pdev_id) void ath11k_mac_drain_tx(struct ath11k *ar); void ath11k_mac_peer_cleanup_all(struct ath11k *ar); -int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx); +void ath11k_mac_tx_mgmt_pending_free(struct ath11k *ar); u8 ath11k_mac_bw_to_mac80211_bw(u8 bw); enum nl80211_he_gi ath11k_mac_he_gi_to_nl80211_he_gi(u8 sgi); enum nl80211_he_ru_alloc ath11k_mac_phy_he_ru_to_nl80211_he_ru_alloc(u16 ru_phy); -- 2.34.1