mt76: add missing locking around ampdu action
authorFelix Fietkau <nbd@nbd.name>
Mon, 7 Oct 2019 10:32:14 +0000 (12:32 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 20 Nov 2019 12:23:50 +0000 (13:23 +0100)
This is needed primarily to avoid races in dealing with rx aggregation
related data structures

Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7603/main.c
drivers/net/wireless/mediatek/mt76/mt7615/main.c
drivers/net/wireless/mediatek/mt76/mt76x02_util.c

index 31cce1c005c6f92376cf479e81fbfe8f1d43eb5c..a0632ca198f10745a2fe86606bd0b06320e88e26 100644 (file)
@@ -575,6 +575,7 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 
        mtxq = (struct mt76_txq *)txq->drv_priv;
 
+       mutex_lock(&dev->mt76.mutex);
        switch (action) {
        case IEEE80211_AMPDU_RX_START:
                mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn,
@@ -603,6 +604,7 @@ mt7603_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
                break;
        }
+       mutex_unlock(&dev->mt76.mutex);
 
        return 0;
 }
index 602add1be0293d47c0fd1d85d225656ca7de943a..7e1e1481219a2b6151c2a6f75ebc0caff766d868 100644 (file)
@@ -489,6 +489,7 @@ mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 
        mtxq = (struct mt76_txq *)txq->drv_priv;
 
+       mutex_lock(&dev->mt76.mutex);
        switch (action) {
        case IEEE80211_AMPDU_RX_START:
                mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn,
@@ -518,6 +519,7 @@ mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
                break;
        }
+       mutex_unlock(&dev->mt76.mutex);
 
        return 0;
 }
index 23134bb8690b180e845152ccdedb1730d173bcd9..ceb0325e1fd04a65373b1f13433d2e3aefb1bf1a 100644 (file)
@@ -372,6 +372,7 @@ int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 
        mtxq = (struct mt76_txq *)txq->drv_priv;
 
+       mutex_lock(&dev->mt76.mutex);
        switch (action) {
        case IEEE80211_AMPDU_RX_START:
                mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid,
@@ -400,6 +401,7 @@ int mt76x02_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
                break;
        }
+       mutex_unlock(&dev->mt76.mutex);
 
        return 0;
 }