612b5f87383176997c733136c6f4e9d6f167076d
[openwrt/staging/ansuel.git] /
1 From 1213acb478a7181cd73eeaf00db430f1e45b1361 Mon Sep 17 00:00:00 2001
2 From: Martin Kaistra <martin.kaistra@linutronix.de>
3 Date: Thu, 11 Jan 2024 17:36:27 +0100
4 Subject: [PATCH 1/2] wifi: rtl8xxxu: add cancel_work_sync() for c2hcmd_work
5
6 The workqueue might still be running, when the driver is stopped. To
7 avoid a use-after-free, call cancel_work_sync() in rtl8xxxu_stop().
8
9 Fixes: e542e66b7c2e ("rtl8xxxu: add bluetooth co-existence support for single antenna")
10 Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
11 Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
12 Signed-off-by: Kalle Valo <kvalo@kernel.org>
13 Link: https://msgid.link/20240111163628.320697-2-martin.kaistra@linutronix.de
14 ---
15 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 +
16 1 file changed, 1 insertion(+)
17
18 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
19 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
20 @@ -7480,6 +7480,7 @@ static void rtl8xxxu_stop(struct ieee802
21 if (priv->usb_interrupts)
22 rtl8xxxu_write32(priv, REG_USB_HIMR, 0);
23
24 + cancel_work_sync(&priv->c2hcmd_work);
25 cancel_delayed_work_sync(&priv->ra_watchdog);
26
27 rtl8xxxu_free_rx_resources(priv);