Unverified Commit c349aaad authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!5093 wifi: mac80211: fix potential key use-after-free

parents 7ca2e454 a4f4c725
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -509,6 +509,9 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
		sta->cipher_scheme = cs;

	err = ieee80211_key_link(key, sdata, sta);
	/* KRACK protection, shouldn't happen but just silently accept key */
	if (err == -EALREADY)
		err = 0;

 out_unlock:
	mutex_unlock(&local->sta_mtx);
+1 −1
Original line number Diff line number Diff line
@@ -843,7 +843,7 @@ int ieee80211_key_link(struct ieee80211_key *key,
	 */
	if (ieee80211_key_identical(sdata, old_key, key)) {
		ieee80211_key_free_unused(key);
		ret = 0;
		ret = -EALREADY;
		goto out;
	}