Skip to contentSkip to conversation

wifi: rtw88: delete timer and free skb queue when unloading

PATCH Applied Artem Dinaburg 2 participants 2 messages Sep 24 – Sep 25

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: rtw88: delete timer and free skb queue when unloading

From: Dmitry Antipov <[email protected]>

[ Upstream commit 634fcbcaa4062db39aeb5ac6ed1bc1feb8dd5216 ]

Fix possible crash and memory leak on driver unload by deleting TX purge timer and freeing C2H queue in 'rtw_core_deinit()', shrink critical section in the latter by freeing COEX queue out of TX report lock scope.

[ Backport to 6.1.y: the source change is unchanged; only hunk locations
in rtw_core_deinit() differ. The target-only Fixes trailer names the initial rtw88 driver commit, which introduced this lifetime. ]

Fixes e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Assisted-by LLM

---
Hi Greg, Sasha, and rtw88 maintainers,

I am continuing with CVE backports still missing from 6.1.y. This fix is inherited by v6.6 and every later mainline release, but 6.1.y still has the affected code. The target-specific adjustment is described in the bracketed note above.

Could you please queue it for 6.1.y?

Thanks,
Artem Dinaburg

CVE: CVE-2023-53574

Build: This patch was included in the x86_64 allmodconfig and CONFIG_WERROR=y build.
It produced vmlinux and modules with no new warnings or errors.

AI assistance: An LLM helped find, adapt, and validate this backport; I reviewed the patch and test output.

 drivers/net/wireless/realtek/rtw88/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/main.c +3 -1
index 8f486152fbd9fe..53c61758d57a0e 100644
@@ -2135,10 +2135,12 @@ void rtw_core_deinit(struct rtw_dev *rtwdev)
 		release_firmware(wow_fw->firmware);
 
 	destroy_workqueue(rtwdev->tx_wq);
+	timer_delete_sync(&rtwdev->tx_report.purge_timer);
 	spin_lock_irqsave(&rtwdev->tx_report.q_lock, flags);
 	ieee80211_purge_tx_queue(rtwdev->hw, &rtwdev->tx_report.queue);
-	skb_queue_purge(&rtwdev->coex.queue);
 	spin_unlock_irqrestore(&rtwdev->tx_report.q_lock, flags);
+	skb_queue_purge(&rtwdev->coex.queue);
+	skb_queue_purge(&rtwdev->c2h_queue);
 
 	list_for_each_entry_safe(rsvd_pkt, tmp, &rtwdev->rsvd_page_list,
 				 build_list) {
Signature · 1 line
2.39.5
maintainer Applied
#1 lore raw
Quoted 3 lines

[ Backport to 6.1.y: the source change is unchanged; only hunk locations
in rtw_core_deinit() differ. The target-only Fixes trailer names the initial rtw88 driver commit, which introduced this lifetime. ]

Queued for 6.1, thanks.

Signature · 2 lines
Thanks,
Sasha