mt76: fix potential deadlock on cancelling workqueues

mutex->lock must not be held while cancelling workqueues, because it is held
by the workqueue items themselves

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2019-03-22 13:29:47 +01:00
parent 7e9e9ad734
commit 3a7e6bbac3
5 changed files with 13 additions and 10 deletions
+2 -2
View File
@@ -91,6 +91,7 @@ static void mt76x0u_mac_stop(struct mt76x02_dev *dev)
if (test_bit(MT76_REMOVED, &dev->mt76.state))
return;
mutex_lock(&dev->mt76.mutex);
mt76_clear(dev, MT_BEACON_TIME_CFG, MT_BEACON_TIME_CFG_TIMER_EN |
MT_BEACON_TIME_CFG_SYNC_MODE | MT_BEACON_TIME_CFG_TBTT_EN |
MT_BEACON_TIME_CFG_BEACON_TX);
@@ -102,6 +103,7 @@ static void mt76x0u_mac_stop(struct mt76x02_dev *dev)
if (!mt76_poll(dev, MT_USB_DMA_CFG, MT_USB_DMA_CFG_RX_BUSY, 0, 1000))
dev_warn(dev->mt76.dev, "RX DMA did not stop\n");
mutex_unlock(&dev->mt76.mutex);
}
static int mt76x0u_start(struct ieee80211_hw *hw)
@@ -131,9 +133,7 @@ static void mt76x0u_stop(struct ieee80211_hw *hw)
{
struct mt76x02_dev *dev = hw->priv;
mutex_lock(&dev->mt76.mutex);
mt76x0u_mac_stop(dev);
mutex_unlock(&dev->mt76.mutex);
}
static const struct ieee80211_ops mt76x0u_ops = {