diff mbox series

[v3,1/2] wifi: rtl8xxxu: add cancel_work_sync() for c2hcmd_work

Message ID 20240111163628.320697-2-martin.kaistra@linutronix.de (mailing list archive)
State Accepted
Commit 1213acb478a7181cd73eeaf00db430f1e45b1361
Delegated to: Kalle Valo
Headers show
Series wifi: rtl8xxxu: channel switch support | expand

Commit Message

Martin Kaistra Jan. 11, 2024, 4:36 p.m. UTC
The workqueue might still be running, when the driver is stopped. To
avoid a use-after-free, call cancel_work_sync() in rtl8xxxu_stop().

Fixes: e542e66b7c2e ("rtl8xxxu: add bluetooth co-existence support for single antenna")
Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ping-Ke Shih Jan. 12, 2024, 12:14 a.m. UTC | #1
> -----Original Message-----
> From: Martin Kaistra <martin.kaistra@linutronix.de>
> Sent: Friday, January 12, 2024 12:36 AM
> To: linux-wireless@vger.kernel.org
> Cc: Jes Sorensen <Jes.Sorensen@gmail.com>; Kalle Valo <kvalo@kernel.org>; Ping-Ke Shih
> <pkshih@realtek.com>; Bitterblue Smith <rtl8821cerfe2@gmail.com>; Sebastian Andrzej Siewior
> <bigeasy@linutronix.de>
> Subject: [PATCH v3 1/2] wifi: rtl8xxxu: add cancel_work_sync() for c2hcmd_work
> 
> The workqueue might still be running, when the driver is stopped. To
> avoid a use-after-free, call cancel_work_sync() in rtl8xxxu_stop().
> 
> Fixes: e542e66b7c2e ("rtl8xxxu: add bluetooth co-existence support for single antenna")
> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>

Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Kalle Valo Jan. 14, 2024, 7:10 p.m. UTC | #2
Martin Kaistra <martin.kaistra@linutronix.de> wrote:

> The workqueue might still be running, when the driver is stopped. To
> avoid a use-after-free, call cancel_work_sync() in rtl8xxxu_stop().
> 
> Fixes: e542e66b7c2e ("rtl8xxxu: add bluetooth co-existence support for single antenna")
> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>

2 patches applied to wireless-next.git, thanks.

1213acb478a7 wifi: rtl8xxxu: add cancel_work_sync() for c2hcmd_work
ece90a862232 wifi: rtl8xxxu: enable channel switch support
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index aac5940936290..757ebd46452eb 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -7480,6 +7480,7 @@  static void rtl8xxxu_stop(struct ieee80211_hw *hw)
 	if (priv->usb_interrupts)
 		rtl8xxxu_write32(priv, REG_USB_HIMR, 0);
 
+	cancel_work_sync(&priv->c2hcmd_work);
 	cancel_delayed_work_sync(&priv->ra_watchdog);
 
 	rtl8xxxu_free_rx_resources(priv);