From: Chin-Yen Lee 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 Signed-off-by: Ping-Ke Shih --- 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