Skip to contentSkip to conversation

wifi: mt76: mt7615: cancel reset work during unregister

PATCH New Jiale Yao 1 participant 1 message Sep 27

Subsystems (3)
lore
Share & tools
lore

Jiale Yao

author
#0 lore raw

PATCH 1/1 wifi: mt76: mt7615: cancel reset work during unregister

The MCU error interrupt handler queues reset_work on the device workqueue. Device removal can reach mt76_unregister_device() while that work is still pending, since the workqueue is not destroyed until mt76_free_device().

If reset_work runs in this window, it operates on an unregistered hw and can requeue mac_work after ieee80211_unregister_hw() has torn the device down. Cancel it before unregistering the device so it cannot outlive the registered hw.

Fixes 61c4fa721968 ("mt76: mt7615: implement hardware reset support")
---
 drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c +1 -0
index a9178e077fd6..7d8580720cd8 100644
@@ -116,6 +116,7 @@ void mt7615_unregister_device(struct mt7615_dev *dev)
 	mcu_running = mt7615_wait_for_mcu_init(dev);
 
 	mt7615_unregister_ext_phy(dev);
+	cancel_work_sync(&dev->reset_work);
 	mt76_unregister_device(&dev->mt76);
 	if (mcu_running)
 		mt7615_mcu_exit(dev);

base-commit: 93f51579e7df248780214094418f205253383cc5

Signature · 1 line
2.34.1