]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
mt76: add missing locking around ampdu action
authorFelix Fietkau <nbd@nbd.name>
Mon, 7 Oct 2019 10:32:14 +0000 (12:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Oct 2020 11:17:20 +0000 (13:17 +0200)
[ Upstream commit 1a817fa73c3b27a593aadf0029de24db1bbc1a3e ]

This is needed primarily to avoid races in dealing with rx aggregation
related data structures

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
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 25d5b1608bc91d7e2cdc49e8d191826e1007d6db..0a5695c3d92416ecb8e867122a303fc0f2e87a24 100644 (file)
@@ -561,6 +561,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,
@@ -590,6 +591,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 87c748715b5d70091ae38ad66d0bf318941e9bcf..38183aef0eb9239dc51aaff30a83fba9dcb05aec 100644 (file)
@@ -455,6 +455,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,
@@ -485,6 +486,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 aec73a0295e86eb800f38d9d47285b4a47faac13..de0d6f21c621c171f58f0cc5c18c8bc60e1d8b05 100644 (file)
@@ -371,6 +371,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;
 }