mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: mt7925: cancel pending mlo_pm_work
If the device is reset, suspended or unregistered within that window,
the pending work can still run and access vif/bss data that may already
be freed, or send MCU commands while the firmware is not available.
Add cancel_delayed_work_sync(&dev->mlo_pm_work) in all relevant teardown
and suspend paths:
- mt7925_mac_reset_work() (chip reset recovery)
- mt7925e_unregister_device() (PCIe unbind)
- mt7925_pci_suspend() (PCIe bus suspend)
- mt7925_suspend() (mac80211 suspend)
- mt7925u_suspend() (USB bus / runtime suspend)
This ensures the work is stopped before the device state becomes
invalid.
Assisted-by: kimi-cli:kimi-k2.7 code
Assisted-by: atomcode:glm-5.2 #Reported-by
Fixes: 276a568832577 ("wifi: mt76: mt7925: update the power-saving flow")
Cc: [email protected]
Signed-off-by: Wentao Guan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
98c13eb564
commit
29d3554195
@@ -1522,6 +1522,7 @@ void mt7925_mac_reset_work(struct work_struct *work)
|
||||
|
||||
cancel_delayed_work_sync(&dev->mphy.mac_work);
|
||||
cancel_delayed_work_sync(&pm->ps_work);
|
||||
cancel_delayed_work_sync(&dev->mlo_pm_work);
|
||||
cancel_work_sync(&pm->wake_work);
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
|
||||
@@ -1640,6 +1640,7 @@ static int mt7925_suspend(struct ieee80211_hw *hw,
|
||||
cancel_delayed_work_sync(&phy->mt76->mac_work);
|
||||
|
||||
cancel_delayed_work_sync(&dev->pm.ps_work);
|
||||
cancel_delayed_work_sync(&dev->mlo_pm_work);
|
||||
mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
|
||||
|
||||
mt792x_mutex_acquire(dev);
|
||||
|
||||
@@ -53,6 +53,7 @@ static void mt7925e_unregister_device(struct mt792x_dev *dev)
|
||||
mt76_for_each_q_rx(&dev->mt76, i)
|
||||
napi_disable(&dev->mt76.napi[i]);
|
||||
cancel_delayed_work_sync(&pm->ps_work);
|
||||
cancel_delayed_work_sync(&dev->mlo_pm_work);
|
||||
cancel_work_sync(&pm->wake_work);
|
||||
|
||||
mt7925_tx_token_put(dev);
|
||||
@@ -740,6 +741,7 @@ static int mt7925_pci_suspend(struct device *device)
|
||||
dev->hif_resumed = false;
|
||||
flush_work(&dev->reset_work);
|
||||
cancel_delayed_work_sync(&pm->ps_work);
|
||||
cancel_delayed_work_sync(&dev->mlo_pm_work);
|
||||
cancel_work_sync(&pm->wake_work);
|
||||
|
||||
mt7925_roc_abort_sync(dev);
|
||||
|
||||
@@ -276,6 +276,7 @@ static int mt7925u_suspend(struct usb_interface *intf, pm_message_t state)
|
||||
pm->suspended = true;
|
||||
dev->hif_resumed = false;
|
||||
flush_work(&dev->reset_work);
|
||||
cancel_delayed_work_sync(&dev->mlo_pm_work);
|
||||
|
||||
mt76_connac_mcu_set_hif_suspend(&dev->mt76, true, false);
|
||||
ret = wait_event_timeout(dev->wait,
|
||||
|
||||
Reference in New Issue
Block a user