From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385062; b=AX9Nx1KLiCO+3het85nnLzEPcx3+PeCo6fGjlgeesD26z14y/nrJds3ihJbt7nMi2ML3 33IdxmOnfsuwvKiJByNBmnsWPPqgClvsdGwzNozGeEKkr0G6W1IhbAU724BXmWU9eQbjI pZeHdv0a0eLzH7g23W6GSRheUleBnevpFM5PtevHjQM18Fd2NylU77iZEvJJFXwWO7Oiv jIq1DqPtgKHQwiJon+P0q3Ts6WRof64J490tdq7iCIH3BqvYuaPqcGs2i5n+6VYM+Nygt GLnf8amCohFektifdDpb1zuAXXGYyosMtV1sWniUiVz68XhY8bpKXeMRTgTylBBMhPw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385062; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=ug+VQMd8y06gQ/txcuKG3e+Cy5EUhpG5dSGacN/Hw6g=; b=DHaMKyOjdHzuAcmcxuz9uYyOx6VSvmVXHsf56XFZbbk4zzx6HbeCxjWNPEIHFxZD/w6W 3ED3EIytOA1k+qWeS2aZKOIuAlESXbDtxT+rJwI+sedbyenxMxRcEuJBk/rQ1Rcm67Poe Gmey6HKwV6hSy86SDnQUd4G6wGBPYkrSqUkocitWGas3UEjuJhkD4f8dCr5SQbxUzdPfc OizEJxJIhOGONxP+JkUhChd72fqtBNJPskXfz7upp8qyALfruNXgElTKEP3pb9h8nRoCX umxAcM29mX+ae9pRW/Ot+QNhIRtbBjjPiSi+Hw5q0fMRQBmm9jXH5qHZ1KZ/x2u0xSw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=HpJExbEx; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90F76606A322; Fri, 4 Dec 2026 11:51:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=HpJExbEx Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9BD81F000CE; Fri, 4 Dec 2026 11:51:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385062; bh=ug+VQMd8y06gQ/txcuKG3e+Cy5EUhpG5dSGacN/Hw6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HpJExbExESDky0eRgk8TNplZ8y2k+XZm4Zp5hN528ms8pMzqTqCV65YVe3L91OZmf iX7g+RtnULOXefzUA98SWuJixt9dbbJi55VdKq2Rnsd05LYIEGJeSDVH5itrXfClDv 5xH6o2JuKgMhsiVK2d3TZAAgxJ/yoiKymbTj9/qs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jiale Yao , Baochen Qiang , Rameshkumar Sundaram , Jeff Johnson , Sasha Levin Subject: [PATCH 6.6 0402/1167] wifi: ath12k: avoid IDR mutation during pending mgmt TX cleanup Date: Fri, 4 Dec 2026 18:57:09 +0900 Message-ID: <20261204100712.498753906@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiale Yao [ Upstream commit 94c7b50351fd30e1dfe1b4051197a1445d8547e1 ] 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: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") Signed-off-by: Jiale Yao Reviewed-by: Baochen Qiang Reviewed-by: Rameshkumar Sundaram Link: https://patch.msgid.link/20261003092104.520135-5-yaojiale02@163.com Signed-off-by: Jeff Johnson [ sashal: Context-only adjustments for the older file layout: the core.c call sits in a flat loop, the unregister caller has an older function name, and mac.h lacks a neighboring declaration. ] Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath12k/core.c | 3 +-- drivers/net/wireless/ath/ath12k/mac.c | 12 ++++++------ drivers/net/wireless/ath/ath12k/mac.h | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index 1b07a183aaedc..1b3c6fbe766e0 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -709,8 +709,7 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab) complete(&ar->bss_survey_done); wake_up(&ar->dp.tx_empty_waitq); - idr_for_each(&ar->txmgmt_idr, - ath12k_mac_tx_mgmt_pending_free, ar); + ath12k_mac_tx_mgmt_pending_free(ar); idr_destroy(&ar->txmgmt_idr); wake_up(&ar->txmgmt_empty_waitq); } diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 2c29aa63dfb07..fdbb0f4fa679d 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -4764,13 +4764,13 @@ static void ath12k_mac_tx_mgmt_free(struct ath12k *ar, int buf_id) ath12k_mgmt_over_wmi_tx_drop(ar, msdu); } -int ath12k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx) +void ath12k_mac_tx_mgmt_pending_free(struct ath12k *ar) { - struct ath12k *ar = ctx; - - ath12k_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) + ath12k_mac_tx_mgmt_free(ar, buf_id); } static void ath12k_mac_vif_txmgmt_cleanup(struct ath12k *ar, @@ -7186,7 +7186,7 @@ static void __ath12k_mac_unregister(struct ath12k *ar) ieee80211_unregister_hw(ar->hw); - idr_for_each(&ar->txmgmt_idr, ath12k_mac_tx_mgmt_pending_free, ar); + ath12k_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/ath12k/mac.h b/drivers/net/wireless/ath/ath12k/mac.h index ec1be11cce7fc..f78cfe610680b 100644 --- a/drivers/net/wireless/ath/ath12k/mac.h +++ b/drivers/net/wireless/ath/ath12k/mac.h @@ -69,7 +69,7 @@ struct ath12k *ath12k_mac_get_ar_by_pdev_id(struct ath12k_base *ab, u32 pdev_id) void ath12k_mac_drain_tx(struct ath12k *ar); void ath12k_mac_peer_cleanup_all(struct ath12k *ar); -int ath12k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx); +void ath12k_mac_tx_mgmt_pending_free(struct ath12k *ar); enum rate_info_bw ath12k_mac_bw_to_mac80211_bw(enum ath12k_supported_bw bw); enum ath12k_supported_bw ath12k_mac_mac80211_bw_to_ath12k_bw(enum rate_info_bw bw); enum hal_encrypt_type ath12k_dp_tx_get_encrypt_type(u32 cipher); -- 2.53.0