This change cancels delayed work on the scan_work workqueue before the workqueue is destroyed by the call to iee80211_unregister_hw in mt76_unregister_device. Without this change, if the device rapidly registered and unregistered, work will attempt to execute on the workqueue after it is destroyed. Signed-off-by: David Ruth <druth@xxxxxxxxxxxx> --- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 2 ++ drivers/net/wireless/mediatek/mt76/mt7921/sdio.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c index a7430216a80d..2c89bbccce4e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -42,7 +42,9 @@ static void mt7921e_unregister_device(struct mt792x_dev *dev) { int i; struct mt76_connac_pm *pm = &dev->pm; + struct mt792x_phy *phy = dev->mt76.phy->priv; + cancel_delayed_work_sync(&phy->scan_work); cancel_work_sync(&dev->init_work); mt76_unregister_device(&dev->mt76); mt76_for_each_q_rx(&dev->mt76, i) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c index 004d942ee11a..1bcfb6944a1f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c @@ -41,7 +41,9 @@ static void mt7921s_txrx_worker(struct mt76_worker *w) static void mt7921s_unregister_device(struct mt792x_dev *dev) { struct mt76_connac_pm *pm = &dev->pm; + struct mt792x_phy *phy = dev->mt76.phy->priv; + cancel_delayed_work_sync(&phy->scan_work); cancel_work_sync(&dev->init_work); mt76_unregister_device(&dev->mt76); cancel_delayed_work_sync(&pm->ps_work); -- 2.46.0.rc2.264.g509ed76dc8-goog