wifi: mt76: mt7915: hold dev->mt76.mutex while disabling tx worker
authorFelix Fietkau <nbd@nbd.name>
Tue, 27 Aug 2024 09:30:04 +0000 (11:30 +0200)
committerFelix Fietkau <nbd@nbd.name>
Fri, 6 Sep 2024 12:23:07 +0000 (14:23 +0200)
Prevent racing against other functions disabling the same worker

Link: https://patch.msgid.link/20240827093011.18621-17-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7915/mac.c

index dcec27be5a40bd40cb33c05fdcb031529c603d56..fc03cb499e71b596d3c735215fda54622bae5a09 100644 (file)
@@ -1538,12 +1538,14 @@ void mt7915_mac_reset_work(struct work_struct *work)
                set_bit(MT76_RESET, &phy2->mt76->state);
                cancel_delayed_work_sync(&phy2->mt76->mac_work);
        }
+
+       mutex_lock(&dev->mt76.mutex);
+
        mt76_worker_disable(&dev->mt76.tx_worker);
        mt76_for_each_q_rx(&dev->mt76, i)
                napi_disable(&dev->mt76.napi[i]);
        napi_disable(&dev->mt76.tx_napi);
 
-       mutex_lock(&dev->mt76.mutex);
 
        if (mtk_wed_device_active(&dev->mt76.mmio.wed))
                mtk_wed_device_stop(&dev->mt76.mmio.wed);