From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <gary.chang@realtek.com>, <timlee@realtek.com>
Subject: [PATCH rtw-next 2/2] wifi: rtw89: protect TXQ scheduling with RCU
Date: Fri, 4 Dec 2026 15:28:58 +0800 [thread overview]
Message-ID: <20261204072858.56688-3-pkshih@realtek.com> (raw)
In-Reply-To: <20261204072858.56688-1-pkshih@realtek.com>
From: Chin-Yen Lee <timlee@realtek.com>
The TXQ and its associated station may be freed while the TX worker is
still accessing them. Move the RCU read-side lock from
rtw89_core_txq_push() to rtw89_core_txq_work() to cover the entire TXQ
scheduling operation, including TXQ acquisition, processing and returning
the TXQ to mac80211.
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw89/core.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index b4d72403e0b0..0f30aaa6502d 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -4816,12 +4816,11 @@ static void rtw89_core_txq_push(struct rtw89_dev *rtwdev,
unsigned long i;
int ret;
- rcu_read_lock();
for (i = 0; i < frame_cnt; i++) {
skb = ieee80211_tx_dequeue_ni(rtwdev->hw, txq);
if (!skb) {
rtw89_debug(rtwdev, RTW89_DBG_TXRX, "dequeue a NULL skb\n");
- goto out;
+ break;
}
rtw89_core_txq_check_agg(rtwdev, rtwtxq, skb);
ret = rtw89_core_tx_write(rtwdev, vif, sta, skb, NULL);
@@ -4831,8 +4830,6 @@ static void rtw89_core_txq_push(struct rtw89_dev *rtwdev,
break;
}
}
-out:
- rcu_read_unlock();
}
static u32 rtw89_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev, u8 tid)
@@ -4944,8 +4941,10 @@ static void rtw89_core_txq_work(struct work_struct *w)
bool reinvoke = false;
u8 ac;
+ rcu_read_lock();
for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
rtw89_core_txq_schedule(rtwdev, ac, &reinvoke);
+ rcu_read_unlock();
if (reinvoke) {
/* reinvoke to process the last frame */
--
2.53.0
prev parent reply other threads:[~2026-12-04 7:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 7:28 [PATCH rtw-next 0/2] wifi: rtw89: recover RFK flaw and protect TXQ with RCU Ping-Ke Shih
2026-12-04 7:28 ` [PATCH rtw-next 1/2] wifi: rtw89: recover from RFK overflow on RTL8852B/RTL8852BT Ping-Ke Shih
2026-12-04 7:28 ` Ping-Ke Shih [this message]
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=20261204072858.56688-3-pkshih@realtek.com \
--to=pkshih@realtek.com \
--cc=gary.chang@realtek.com \
--cc=linux-wireless@vger.kernel.org \
--cc=timlee@realtek.com \
/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