--- zzzz-none-000/linux-4.9.276/net/mac80211/key.c 2021-07-20 14:21:16.000000000 +0000 +++ falcon-5530-750/linux-4.9.276/net/mac80211/key.c 2023-04-05 08:19:02.000000000 +0000 @@ -688,6 +688,21 @@ key->sdata = sdata; key->sta = sta; + /* + * Silently accept key re-installation without really installing the + * new version of the key to avoid nonce reuse or replay issues. + */ + if (old_key && key->conf.keylen == old_key->conf.keylen && + !memcmp(key->conf.key, old_key->conf.key, key->conf.keylen)) { + ieee80211_key_free_unused(key); + ret = 0; + goto out; + } + + key->local = sdata->local; + key->sdata = sdata; + key->sta = sta; + increment_tailroom_need_count(sdata); ieee80211_key_replace(sdata, sta, pairwise, old_key, key); @@ -750,6 +765,7 @@ ieee80211_key_enable_hw_accel(key); } +out: mutex_unlock(&sdata->local->key_mtx); }