hw_key_idx is initialized to -1 (0xFF, meaning "no key") in mt76_wcid_init(), but hw_key_idx2 (used for AES-CMAC/BIGTK key tracking) is left at the kzalloc default of 0. This makes the two key index slots inconsistent: code that checks whether all group keys have been removed cannot use a uniform "== (u8)-1" test on both slots. Initialize hw_key_idx2 to -1 alongside hw_key_idx so both use the same "no key installed" sentinel. This does not change runtime behavior since all existing consumers compare hw_key_idx2 against explicit key indices (6 or 7) which are distinct from both 0 and 0xFF. Fixes: 730d6d0da8d8 ("mt76: mt7615: fix key set/delete issues") Signed-off-by: Joshua Klinesmith --- drivers/net/wireless/mediatek/mt76/mac80211.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 75772979f438..5eea3b4f27dc 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -1690,6 +1690,7 @@ EXPORT_SYMBOL_GPL(mt76_sta_pre_rcu_remove); void mt76_wcid_init(struct mt76_wcid *wcid, u8 band_idx) { wcid->hw_key_idx = -1; + wcid->hw_key_idx2 = -1; wcid->phy_idx = band_idx; INIT_LIST_HEAD(&wcid->tx_list); -- 2.43.0