mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 20:14:06 +02:00
wifi: mac80211: verify state before connection
ieee80211_prep_connection is supposed to be called when both bitmaps (valid_links and active_links) are cleared. Make sure of it and WARN if this is not the case, to avoid weird issues. Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Link: https://patch.msgid.link/20250609213231.f616c7b693df.Ie983155627ad0d2e7c19c30ce642915246d0ed9d@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
be1ba9ed22
commit
eb7186bd82
|
|
@ -8698,21 +8698,33 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
|
|||
bool have_sta = false;
|
||||
bool mlo;
|
||||
int err;
|
||||
u16 new_links;
|
||||
|
||||
if (link_id >= 0) {
|
||||
mlo = true;
|
||||
if (WARN_ON(!ap_mld_addr))
|
||||
return -EINVAL;
|
||||
err = ieee80211_vif_set_links(sdata, BIT(link_id), 0);
|
||||
new_links = BIT(link_id);
|
||||
} else {
|
||||
if (WARN_ON(ap_mld_addr))
|
||||
return -EINVAL;
|
||||
ap_mld_addr = cbss->bssid;
|
||||
err = ieee80211_vif_set_links(sdata, 0, 0);
|
||||
new_links = 0;
|
||||
link_id = 0;
|
||||
mlo = false;
|
||||
}
|
||||
|
||||
if (assoc) {
|
||||
rcu_read_lock();
|
||||
have_sta = sta_info_get(sdata, ap_mld_addr);
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
if (mlo && !have_sta &&
|
||||
WARN_ON(sdata->vif.valid_links || sdata->vif.active_links))
|
||||
return -EINVAL;
|
||||
|
||||
err = ieee80211_vif_set_links(sdata, new_links, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
@ -8733,12 +8745,6 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
|
|||
goto out_err;
|
||||
}
|
||||
|
||||
if (assoc) {
|
||||
rcu_read_lock();
|
||||
have_sta = sta_info_get(sdata, ap_mld_addr);
|
||||
rcu_read_unlock();
|
||||
}
|
||||
|
||||
if (!have_sta) {
|
||||
if (mlo)
|
||||
new_sta = sta_info_alloc_with_link(sdata, ap_mld_addr,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user