diff mbox series

[1/3,v4] wifi: rtw88: delete timer and free skb queue when unloading

Message ID 20230621092313.65965-1-dmantipov@yandex.ru (mailing list archive)
State Superseded
Delegated to: Kalle Valo
Headers show
Series [1/3,v4] wifi: rtw88: delete timer and free skb queue when unloading | expand

Commit Message

Dmitry Antipov June 21, 2023, 9:22 a.m. UTC
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.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
v4: adjust to match series
v3: shrink critical section in rtw_core_deinit() (Ping-Ke Shih)
v2: fix title and commit message (Kalle Valo)
---
 drivers/net/wireless/realtek/rtw88/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ping-Ke Shih June 21, 2023, 11:22 a.m. UTC | #1
On Wed, 2023-06-21 at 12:22 +0300, Dmitry Antipov wrote:
> 
> 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.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>

[...]
Ping-Ke Shih June 21, 2023, 11:25 a.m. UTC | #2
On Wed, 2023-06-21 at 11:22 +0000, Ping-Ke Shih wrote:
> On Wed, 2023-06-21 at 12:22 +0300, Dmitry Antipov wrote:
> > 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.
> > 
> > Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> 
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
> 

Sorry, I'm not maintainer of rtw88, so I should add reviewed-by.

Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 9447a3aae3b5..c190598c47c3 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -2180,10 +2180,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);
 	skb_queue_purge(&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) {