From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.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 B96E43B7760; Sat, 3 Oct 2026 09:21:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.3 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791019300; cv=none; b=pAYQiLMGBgY8YfQhLbfEGiA6E+sTy+/hCLeJOHdTYltHYX1CL7mjdVDwpM+cXEkMn+IPr/JiywWgEaHSDg/vAGl4725picbndErlognJPxHqnqSphBLHW0SjFWRnps/dcI+1vWDNtK/dEWhSQUfz3DeNl/78/veYjaJhsjkNLVg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791019300; c=relaxed/simple; bh=ijt+uXRKsCRVh+8BJIJkrcZ142paWoR/YdkU3SQA7Zc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PNGUK7ViHAqlfQZs3l2V6vS1pIrp2bf7IUc109x8zjuadrGT7MHx0eEcvV7PqMklsjU6b+XR7jZ6dQuLQwSQ9M3636w1KnP+yhLaC4950+ZCOY//V/dMzaU8No5Ebl6gpNvc8PeuEOauQd38bMWzKaqKigl80AZdmSJuEMe8Th0= 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=eYbGMiZF; arc=none smtp.client-ip=117.135.210.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="eYbGMiZF" 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=rL ZRDyv5CTca4S0S1McTqMKZPbZhg51Wnca9mh1+pZQ=; b=eYbGMiZFCLueTO10eu 680QyIMQwnICq3WFNl//EGEnYXckRw4I0or6DYegnTw0T3tOaZ4dpi9MzhhAvNOE ZNY0XPvYA/LZDMJhxCsv56yzfx9pwXMYpzR/XFoglxr9FWfFiBbTfv6Hr86dnC1e mP1bwlNt4HvX6C38SvN0hzT90= Received: from pc.localdomain (unknown []) by gzga-smtp-mtada-g1-3 (Coremail) with SMTP id _____wD3n1YCycBqC7WjCQ--.62376S5; Sat, 03 Oct 2026 17:21:11 +0800 (CST) From: Jiale Yao To: Jeff Johnson , Maharaja Kennadyrajan , Govindaraj Saminathan , Karthikeyan Periyasamy , Rajkumar Manoharan , Sriram R , linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Jiale Yao Subject: [PATCH v2 3/5] wifi: ath11k: avoid IDR mutation during vif mgmt TX cleanup Date: Sat, 3 Oct 2026 17:21:00 +0800 Message-Id: <20261003092104.520135-4-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--.62376S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7Ar4UtFW8Jry7ZryrWFW5trb_yoW8tFykpF 4UW342kFy8AF47Xr4rCw45A3WrXas8K39Ikr45G34rJFnFyF1SgFyFvF1ayrWFya18GFy2 krWUtr15G3yDG3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zR5rchUUUUU= X-CM-SenderInfo: x1dryxhdohiji6rwjhhfrp/xtbCzQc+eGrAyQeNCQAA3s 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 f9af403a2f0d..e7ece258f142 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6176,16 +6176,18 @@ void ath11k_mac_tx_mgmt_pending_free(struct ath11k *ar) ath11k_mac_tx_mgmt_free(ar, buf_id); } -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, @@ -7416,8 +7418,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