]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: rtl8xxxu: add cancel_work_sync() for c2hcmd_work
authorMartin Kaistra <martin.kaistra@linutronix.de>
Thu, 11 Jan 2024 16:36:27 +0000 (17:36 +0100)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:16:31 +0000 (18:16 -0400)
[ Upstream commit 1213acb478a7181cd73eeaf00db430f1e45b1361 ]

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>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240111163628.320697-2-martin.kaistra@linutronix.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c

index 180907319e8cd930e3be59b3fc1270fee19386a3..04df0f54aa66735a86007b6f1bddba4e4e661318 100644 (file)
@@ -7304,6 +7304,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);