mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
wifi: mac80211: skip non-uploaded keys in ieee80211_iter_keys
[ Upstream commit 52009b419355195912a628d0a9847922e90c348c ]
Sync iterator conditions with ieee80211_iter_keys_rcu.
Fixes: 830af02f24
("mac80211: allow driver to iterate keys")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://patch.msgid.link/20241006153630.87885-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
021693dad1
commit
189f1bfc5c
1 changed files with 25 additions and 17 deletions
|
@ -989,6 +989,26 @@ void ieee80211_reenable_keys(struct ieee80211_sub_if_data *sdata)
|
||||||
mutex_unlock(&sdata->local->key_mtx);
|
mutex_unlock(&sdata->local->key_mtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ieee80211_key_iter(struct ieee80211_hw *hw,
|
||||||
|
struct ieee80211_vif *vif,
|
||||||
|
struct ieee80211_key *key,
|
||||||
|
void (*iter)(struct ieee80211_hw *hw,
|
||||||
|
struct ieee80211_vif *vif,
|
||||||
|
struct ieee80211_sta *sta,
|
||||||
|
struct ieee80211_key_conf *key,
|
||||||
|
void *data),
|
||||||
|
void *iter_data)
|
||||||
|
{
|
||||||
|
/* skip keys of station in removal process */
|
||||||
|
if (key->sta && key->sta->removed)
|
||||||
|
return;
|
||||||
|
if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))
|
||||||
|
return;
|
||||||
|
iter(hw, vif, key->sta ? &key->sta->sta : NULL,
|
||||||
|
&key->conf, iter_data);
|
||||||
|
}
|
||||||
|
|
||||||
void ieee80211_iter_keys(struct ieee80211_hw *hw,
|
void ieee80211_iter_keys(struct ieee80211_hw *hw,
|
||||||
struct ieee80211_vif *vif,
|
struct ieee80211_vif *vif,
|
||||||
void (*iter)(struct ieee80211_hw *hw,
|
void (*iter)(struct ieee80211_hw *hw,
|
||||||
|
@ -1008,16 +1028,13 @@ void ieee80211_iter_keys(struct ieee80211_hw *hw,
|
||||||
if (vif) {
|
if (vif) {
|
||||||
sdata = vif_to_sdata(vif);
|
sdata = vif_to_sdata(vif);
|
||||||
list_for_each_entry_safe(key, tmp, &sdata->key_list, list)
|
list_for_each_entry_safe(key, tmp, &sdata->key_list, list)
|
||||||
iter(hw, &sdata->vif,
|
ieee80211_key_iter(hw, vif, key, iter, iter_data);
|
||||||
key->sta ? &key->sta->sta : NULL,
|
|
||||||
&key->conf, iter_data);
|
|
||||||
} else {
|
} else {
|
||||||
list_for_each_entry(sdata, &local->interfaces, list)
|
list_for_each_entry(sdata, &local->interfaces, list)
|
||||||
list_for_each_entry_safe(key, tmp,
|
list_for_each_entry_safe(key, tmp,
|
||||||
&sdata->key_list, list)
|
&sdata->key_list, list)
|
||||||
iter(hw, &sdata->vif,
|
ieee80211_key_iter(hw, &sdata->vif, key,
|
||||||
key->sta ? &key->sta->sta : NULL,
|
iter, iter_data);
|
||||||
&key->conf, iter_data);
|
|
||||||
}
|
}
|
||||||
mutex_unlock(&local->key_mtx);
|
mutex_unlock(&local->key_mtx);
|
||||||
}
|
}
|
||||||
|
@ -1035,17 +1052,8 @@ _ieee80211_iter_keys_rcu(struct ieee80211_hw *hw,
|
||||||
{
|
{
|
||||||
struct ieee80211_key *key;
|
struct ieee80211_key *key;
|
||||||
|
|
||||||
list_for_each_entry_rcu(key, &sdata->key_list, list) {
|
list_for_each_entry_rcu(key, &sdata->key_list, list)
|
||||||
/* skip keys of station in removal process */
|
ieee80211_key_iter(hw, &sdata->vif, key, iter, iter_data);
|
||||||
if (key->sta && key->sta->removed)
|
|
||||||
continue;
|
|
||||||
if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
iter(hw, &sdata->vif,
|
|
||||||
key->sta ? &key->sta->sta : NULL,
|
|
||||||
&key->conf, iter_data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ieee80211_iter_keys_rcu(struct ieee80211_hw *hw,
|
void ieee80211_iter_keys_rcu(struct ieee80211_hw *hw,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue