mt7996_link_sta_fixed_rate_set() dereferenced the phy of link 0, which is NULL on an MLD that never had link 0. Commit 5806c91a3f0d ("wifi: mt76: mt7996: Remove unnecessary phy filed in mt7996_vif_link struct") made it a refusal. Since then, an AP MLD that removed its link 0 refuses the fixed rate of each station link. Take the phy of the interface link that the station link belongs to, like mt7996_sta_hw_queue_read() does. The write is then refused only where that link has no channel context. Fixes: feb06d455620 ("wifi: mt76: mt7996: support fixed rate for link station") Fixes: 5806c91a3f0d ("wifi: mt76: mt7996: Remove unnecessary phy filed in mt7996_vif_link struct") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c index 2ca594618f3b..7c976ec20d10 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/debugfs.c @@ -1035,14 +1035,23 @@ static ssize_t mt7996_link_sta_fixed_rate_set(struct file *file, #define LONG_PREAMBLE 1 struct ieee80211_link_sta *link_sta = file->private_data; struct mt7996_sta *msta = (struct mt7996_sta *)link_sta->sta->drv_priv; - struct mt7996_phy *link_phy = mt7996_vif_link_phy(&msta->vif->deflink); struct mt7996_sta_link *msta_link; + struct mt7996_phy *link_phy = NULL; + struct mt76_vif_link *mlink; struct ra_rate phy = {}; struct mt7996_dev *dev; char buf[100]; int ret; u16 gi, ltf; + rcu_read_lock(); + mlink = rcu_dereference(msta->vif->mt76.link[link_sta->link_id]); + if (mlink) + link_phy = mt7996_vif_link_phy(container_of(mlink, + struct mt7996_vif_link, + mt76)); + rcu_read_unlock(); + if (!link_phy) return -EINVAL; -- 2.47.3