1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

wifi: mac80211: fixes in FILS discovery updates

FILS discovery configuration gets updated only if the maximum interval
is set to a non-zero value, hence there is no way to reset this value
to 0 once set. Replace the check for interval with a new flag which is
set only if the configuration should be updated.

Add similar changes for the unsolicited broadcast probe response handling.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20230727174100.11721-3-quic_alokad@quicinc.com
[move NULL'ing to else branch to not have intermediate NULL visible]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Aloka Dixit 2023-07-27 10:40:57 -07:00 committed by Johannes Berg
parent 0cfaec2599
commit 3b1c256eb4

View file

@ -952,25 +952,29 @@ static int ieee80211_set_fils_discovery(struct ieee80211_sub_if_data *sdata,
struct fils_discovery_data *new, *old = NULL; struct fils_discovery_data *new, *old = NULL;
struct ieee80211_fils_discovery *fd; struct ieee80211_fils_discovery *fd;
if (!params->tmpl || !params->tmpl_len) if (!params->update)
return -EINVAL; return 0;
fd = &link_conf->fils_discovery; fd = &link_conf->fils_discovery;
fd->min_interval = params->min_interval; fd->min_interval = params->min_interval;
fd->max_interval = params->max_interval; fd->max_interval = params->max_interval;
old = sdata_dereference(link->u.ap.fils_discovery, sdata); old = sdata_dereference(link->u.ap.fils_discovery, sdata);
if (old)
kfree_rcu(old, rcu_head);
if (params->tmpl && params->tmpl_len) {
new = kzalloc(sizeof(*new) + params->tmpl_len, GFP_KERNEL); new = kzalloc(sizeof(*new) + params->tmpl_len, GFP_KERNEL);
if (!new) if (!new)
return -ENOMEM; return -ENOMEM;
new->len = params->tmpl_len; new->len = params->tmpl_len;
memcpy(new->data, params->tmpl, params->tmpl_len); memcpy(new->data, params->tmpl, params->tmpl_len);
rcu_assign_pointer(link->u.ap.fils_discovery, new); rcu_assign_pointer(link->u.ap.fils_discovery, new);
} else {
RCU_INIT_POINTER(link->u.ap.fils_discovery, NULL);
}
if (old) return BSS_CHANGED_FILS_DISCOVERY;
kfree_rcu(old, rcu_head);
return 0;
} }
static int static int
@ -981,23 +985,27 @@ ieee80211_set_unsol_bcast_probe_resp(struct ieee80211_sub_if_data *sdata,
{ {
struct unsol_bcast_probe_resp_data *new, *old = NULL; struct unsol_bcast_probe_resp_data *new, *old = NULL;
if (!params->tmpl || !params->tmpl_len) if (!params->update)
return -EINVAL; return 0;
link_conf->unsol_bcast_probe_resp_interval = params->interval;
old = sdata_dereference(link->u.ap.unsol_bcast_probe_resp, sdata); old = sdata_dereference(link->u.ap.unsol_bcast_probe_resp, sdata);
if (old)
kfree_rcu(old, rcu_head);
if (params->tmpl && params->tmpl_len) {
new = kzalloc(sizeof(*new) + params->tmpl_len, GFP_KERNEL); new = kzalloc(sizeof(*new) + params->tmpl_len, GFP_KERNEL);
if (!new) if (!new)
return -ENOMEM; return -ENOMEM;
new->len = params->tmpl_len; new->len = params->tmpl_len;
memcpy(new->data, params->tmpl, params->tmpl_len); memcpy(new->data, params->tmpl, params->tmpl_len);
rcu_assign_pointer(link->u.ap.unsol_bcast_probe_resp, new); rcu_assign_pointer(link->u.ap.unsol_bcast_probe_resp, new);
} else {
RCU_INIT_POINTER(link->u.ap.unsol_bcast_probe_resp, NULL);
}
if (old) return BSS_CHANGED_UNSOL_BCAST_PROBE_RESP;
kfree_rcu(old, rcu_head);
link_conf->unsol_bcast_probe_resp_interval = params->interval;
return 0;
} }
static int ieee80211_set_ftm_responder_params( static int ieee80211_set_ftm_responder_params(
@ -1428,23 +1436,18 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
if (err < 0) if (err < 0)
goto error; goto error;
if (params->fils_discovery.max_interval) { err = ieee80211_set_fils_discovery(sdata, &params->fils_discovery,
err = ieee80211_set_fils_discovery(sdata,
&params->fils_discovery,
link, link_conf); link, link_conf);
if (err < 0) if (err < 0)
goto error; goto error;
changed |= BSS_CHANGED_FILS_DISCOVERY; changed |= err;
}
if (params->unsol_bcast_probe_resp.interval) {
err = ieee80211_set_unsol_bcast_probe_resp(sdata, err = ieee80211_set_unsol_bcast_probe_resp(sdata,
&params->unsol_bcast_probe_resp, &params->unsol_bcast_probe_resp,
link, link_conf); link, link_conf);
if (err < 0) if (err < 0)
goto error; goto error;
changed |= BSS_CHANGED_UNSOL_BCAST_PROBE_RESP; changed |= err;
}
err = drv_start_ap(sdata->local, sdata, link_conf); err = drv_start_ap(sdata->local, sdata, link_conf);
if (err) { if (err) {