From: Praneeth Balasubramanian <praneethb2002@gmail.com>
To: Jeff Johnson <jjohnson@kernel.org>
Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org,
linux-kernel@vger.kernel.org,
Praneeth Balasubramanian <praneethb2002@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH ath-next] wifi: ath11k: Hold the ring lock when returning a monitor link descriptor
Date: Fri, 4 Dec 2026 10:51:20 -0800 [thread overview]
Message-ID: <20261204185120.1688129-1-praneethb2002@gmail.com> (raw)
ath11k_dp_rx_monitor_link_desc_return() writes an entry into a source
ring with ath11k_hal_srng_access_begin(),
ath11k_hal_srng_src_get_next_entry() and ath11k_hal_srng_access_end().
All three assert with lockdep_assert_held() that srng->lock is held, but
this function never takes it. On chips with rxdma1_enable (IPQ8074,
IPQ6018, QCN9074, IPQ5018) it is called for every link descriptor in
monitor mode, so a kernel with lockdep warns three times per call.
The ring it uses there, rxdma_mon_desc_ring, is only written by the
monitor path under pmon->mon_lock, so this is not a data race today.
The function would also pick wbm_desc_rel_ring on chips without
rxdma1, and that ring is shared with ath11k_dp_rx_link_desc_return(),
which takes srng->lock. No current caller reaches that branch.
Take srng->lock around the ring access, as
ath11k_dp_rx_link_desc_return() and ath11k_dp_link_desc_setup() do. Each
ring has its own lock class, so nesting it under the destination ring
lock held by the callers does not trigger lockdep.
The missing lock was found by a static check that turns lockdep
assertions into Clang context-analysis requirements on the callers.
Compile tested only.
Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Cc: stable@vger.kernel.org
Signed-off-by: Praneeth Balasubramanian <praneethb2002@gmail.com>
---
Notes:
This was found by a compiler-based check, part of research at UCSB SecLab.
A lockdep_assert_held() at the start of a function is turned into a Clang
context-analysis requirement (__must_hold) on that function, and Clang 23
with CONFIG_WARN_CONTEXT_ANALYSIS then checks every caller. No LLM was
involved in finding the bug. The patch and changelog were drafted with
Claude Opus 5.5. I reviewed the patch and take responsibility for it.
Testing: builds without new warnings with W=1 (x86_64, clang 23,
allmodconfig). Not runtime-tested; I do not have this hardware, and I
have not seen the warning myself.
drivers/net/wireless/ath/ath11k/dp_rx.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index 6d95f7b343a5..e3844bfb0dd5 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -4542,7 +4542,7 @@ int ath11k_dp_rx_monitor_link_desc_return(struct ath11k *ar,
{
struct ath11k_pdev_dp *dp = &ar->dp;
struct dp_srng *dp_srng;
- void *hal_srng;
+ struct hal_srng *hal_srng;
void *src_srng_desc;
int ret = 0;
@@ -4554,6 +4554,8 @@ int ath11k_dp_rx_monitor_link_desc_return(struct ath11k *ar,
hal_srng = &ar->ab->hal.srng_list[dp_srng->ring_id];
}
+ spin_lock_bh(&hal_srng->lock);
+
ath11k_hal_srng_access_begin(ar->ab, hal_srng);
src_srng_desc = ath11k_hal_srng_src_get_next_entry(ar->ab, hal_srng);
@@ -4569,6 +4571,9 @@ int ath11k_dp_rx_monitor_link_desc_return(struct ath11k *ar,
}
ath11k_hal_srng_access_end(ar->ab, hal_srng);
+
+ spin_unlock_bh(&hal_srng->lock);
+
return ret;
}
--
2.25.1
reply other threads:[~2026-12-04 18:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204185120.1688129-1-praneethb2002@gmail.com \
--to=praneethb2002@gmail.com \
--cc=ath11k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox