]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Oct 2024 10:00:22 +0000 (12:00 +0200)
[ Upstream commit 8f7152f10cb434f954aeff85ca1be9cd4d01912b ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/mediatek/mt76/mt7915/mac.c

index 8008ce3fa6c7eaca4ef8b4f937a2f0117ec56092..387d47e9fcd386d9fd217846bd9b2ed1140e1f22 100644 (file)
@@ -1537,12 +1537,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);