@@ -1303,7 +1303,7 @@ mt76_sta_add(struct mt76_dev *dev, struct ieee80211_vif *vif,
continue;
mtxq = (struct mt76_txq *)sta->txq[i]->drv_priv;
- mtxq->wcid = wcid;
+ rcu_assign_pointer(mtxq->wcid, wcid);
}
ewma_signal_init(&wcid->rssi);
@@ -1379,9 +1379,21 @@ void mt76_sta_pre_rcu_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt76_phy *phy = hw->priv;
struct mt76_dev *dev = phy->dev;
struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;
+ int i;
mutex_lock(&dev->mutex);
rcu_assign_pointer(dev->wcid[wcid->idx], NULL);
+
+ for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
+ struct mt76_txq *mtxq;
+
+ if (!sta->txq[i])
+ continue;
+
+ mtxq = (struct mt76_txq *)sta->txq[i]->drv_priv;
+ rcu_assign_pointer(mtxq->wcid, NULL);
+ }
+
mutex_unlock(&dev->mutex);
}
EXPORT_SYMBOL_GPL(mt76_sta_pre_rcu_remove);
@@ -275,7 +275,7 @@ struct mt76_wcid {
};
struct mt76_txq {
- struct mt76_wcid *wcid;
+ struct mt76_wcid __rcu *wcid;
u16 agg_ssn;
bool send_bar;
@@ -522,7 +522,7 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
mtxq = (struct mt76_txq *)txq->drv_priv;
wcid = mtxq->wcid;
- if (wcid && test_bit(MT_WCID_FLAG_PS, &wcid->flags))
+ if (!wcid || (wcid && test_bit(MT_WCID_FLAG_PS, &wcid->flags)))
continue;
spin_lock_bh(&q->lock);