mt7996_set_hw_key() returns early for a link without a chanctx, also for the key of a station. Since commit e8c819df0243 ("wifi: mt76: mt7996: Destroy active sta links in mt7996_mac_sta_remove()"), a station MLD whose active links were reduced keeps the station links of the inactive links. The hardware can name the WTBL of such a link for frames that arrive on another link. After a PTK rekey that WTBL keeps the old key, so the EAPOL M1 of the next rekey fails decryption and the AP deauthenticates the station. Only skip keys without a station on such a link. The first of them updates the BSS of the link, which needs its phy, and the link uploads them when it gets a chanctx. Fixes: e8c819df0243 ("wifi: mt76: mt7996: Destroy active sta links in mt7996_mac_sta_remove()") Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c index e6b81aa890f4..2c09351a56f3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c @@ -212,9 +212,6 @@ mt7996_set_hw_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, if (!link) return 0; - if (!mt7996_vif_link_phy(link)) - return 0; - if (sta) { struct mt7996_sta *msta; @@ -226,6 +223,9 @@ mt7996_set_hw_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, if (!msta_link->wcid.sta) return -EOPNOTSUPP; } else { + if (!mt7996_vif_link_phy(link)) + return 0; + msta_link = &link->msta_link; } wcid_keyidx = &msta_link->wcid.hw_key_idx; -- 2.47.3