From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.2]) (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 D3DC83B7B8C; Sat, 3 Oct 2026 09:21:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.2 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791019302; cv=none; b=QN9L8eGVSr4Pld1QawqzVwaTBYvYOZPyuOCdciOTq1Kx5jVdY3BYrYPwOuyY4zZmUy4+Q35ejedd1fZspyuLPGtwM/bLWGk3jKA0Ur49PuBh6WXNfl8bNo0HnvqvulY2998F6fbKDb3NL/TR4pWB9PoRBHTQfzs0AsdZ6rb4oj4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791019302; c=relaxed/simple; bh=ZjOaJx2QRozEYg674vKLlSXxIDSv4C0hAMf6nCJ2enc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cTepemriVKKUyQ6rf8jxm/W7Fj+bMNm2GqpS4XYKfcT9obaBsYHxJ9uvFT/G9KaBvHV4xaC0wOeyB4688siz5NBKhREmNyOPUr7IDIzz2d80xjXgjGd7y5+c9CQZvVFhs7coxVVSj42g0BJQytfBwL34Q2WA5iI+v6cEp/YRn5o= 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=cTQOKLpT; arc=none smtp.client-ip=117.135.210.2 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="cTQOKLpT" 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=5j Acakh0V+w1Mu4hFJYcBeyHBo4skXLnPZjvWkRcwaw=; b=cTQOKLpThNkEBB7dTn Qmq4sciAOeOxcrs8DuYxn2oRa22eddZ9bTpLerzlL5MF1pbdSHfl7y6pzaZufiGD j0+4ZOS3wD7ABYNhO/arEuR3lNY5iW8FMryefS6RfZG4rQFc/qIkNsrfslc6rLcs vNP1obK64aWdHjpFCb3tlXKNY= Received: from pc.localdomain (unknown []) by gzga-smtp-mtada-g1-3 (Coremail) with SMTP id _____wD3n1YCycBqC7WjCQ--.62376S7; Sat, 03 Oct 2026 17:21:14 +0800 (CST) From: Jiale Yao To: Jeff Johnson , Vasanthakumar Thiagarajan , Balamurugan Selvarajan , Sriram R , Carl Huang , linux-wireless@vger.kernel.org, ath12k@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Jiale Yao Subject: [PATCH v2 5/5] wifi: ath12k: avoid IDR mutation during vif mgmt TX cleanup Date: Sat, 3 Oct 2026 17:21:02 +0800 Message-Id: <20261003092104.520135-6-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--.62376S7 X-Coremail-Antispam: 1Uf129KBjvJXoW7WFyrKrWkWw4fKr1kAw13Jwb_yoW8tF4DpF 47W342yFyUua15Xrs5Jr45A3WrG3Z8Gana9r4UGas5WF9xAr1agFyFvFy2qryrtF4rKFy2 k3yjkr18Gw4kG3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pib4SwUUUUU= X-CM-SenderInfo: x1dryxhdohiji6rwjhhfrp/xtbC7wo-eWrAyQoqVQAA31 ath12k_mac_vdev_delete() 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: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Signed-off-by: Jiale Yao --- drivers/net/wireless/ath/ath12k/mac.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index c0acb92b7320..108ace48cc97 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -9196,16 +9196,18 @@ void ath12k_mac_tx_mgmt_pending_free(struct ath12k *ar) ath12k_mac_tx_mgmt_free(ar, buf_id); } -static int ath12k_mac_vif_txmgmt_idr_remove(int buf_id, void *skb, void *ctx) +static void ath12k_mac_vif_txmgmt_cleanup(struct ath12k *ar, + struct ieee80211_vif *vif) { - struct ieee80211_vif *vif = ctx; - struct ath12k_skb_cb *skb_cb = ATH12K_SKB_CB(skb); - struct ath12k *ar = skb_cb->ar; - - if (skb_cb->vif == vif) - ath12k_mac_tx_mgmt_free(ar, buf_id); + struct ath12k_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 = ATH12K_SKB_CB(skb); + if (skb_cb->vif == vif) + ath12k_mac_tx_mgmt_free(ar, buf_id); + } } static int ath12k_mac_mgmt_tx_wmi(struct ath12k *ar, struct ath12k_link_vif *arvif, @@ -10967,8 +10969,7 @@ static int ath12k_mac_vdev_delete(struct ath12k *ar, struct ath12k_link_vif *arv ath12k_peer_cleanup(ar, arvif->vdev_id); ath12k_ahvif_put_link_cache(ahvif, arvif->link_id); - idr_for_each(&ar->txmgmt_idr, - ath12k_mac_vif_txmgmt_idr_remove, vif); + ath12k_mac_vif_txmgmt_cleanup(ar, vif); ath12k_mac_vif_unref(ath12k_ab_to_dp(ab), vif); -- 2.34.1