Use a helper function to remove struct wpa_bss_tmp_disallowed entries
It is safer to remove and free these entries with a shared helper function to avoid issues with potentially forgetting to unregister or free something if this structure is extended in the future. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
ecaacb47b7
commit
e8662e9d44
1 changed files with 13 additions and 11 deletions
|
@ -461,16 +461,22 @@ void free_hw_features(struct wpa_supplicant *wpa_s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void remove_bss_tmp_disallowed_entry(struct wpa_supplicant *wpa_s,
|
||||||
|
struct wpa_bss_tmp_disallowed *bss)
|
||||||
|
{
|
||||||
|
eloop_cancel_timeout(wpa_bss_tmp_disallow_timeout, wpa_s, bss);
|
||||||
|
dl_list_del(&bss->list);
|
||||||
|
os_free(bss);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void free_bss_tmp_disallowed(struct wpa_supplicant *wpa_s)
|
void free_bss_tmp_disallowed(struct wpa_supplicant *wpa_s)
|
||||||
{
|
{
|
||||||
struct wpa_bss_tmp_disallowed *bss, *prev;
|
struct wpa_bss_tmp_disallowed *bss, *prev;
|
||||||
|
|
||||||
dl_list_for_each_safe(bss, prev, &wpa_s->bss_tmp_disallowed,
|
dl_list_for_each_safe(bss, prev, &wpa_s->bss_tmp_disallowed,
|
||||||
struct wpa_bss_tmp_disallowed, list) {
|
struct wpa_bss_tmp_disallowed, list)
|
||||||
eloop_cancel_timeout(wpa_bss_tmp_disallow_timeout, wpa_s, bss);
|
remove_bss_tmp_disallowed_entry(wpa_s, bss);
|
||||||
dl_list_del(&bss->list);
|
|
||||||
os_free(bss);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8176,8 +8182,7 @@ static void wpa_bss_tmp_disallow_timeout(void *eloop_ctx, void *timeout_ctx)
|
||||||
dl_list_for_each(tmp, &wpa_s->bss_tmp_disallowed,
|
dl_list_for_each(tmp, &wpa_s->bss_tmp_disallowed,
|
||||||
struct wpa_bss_tmp_disallowed, list) {
|
struct wpa_bss_tmp_disallowed, list) {
|
||||||
if (bss == tmp) {
|
if (bss == tmp) {
|
||||||
dl_list_del(&tmp->list);
|
remove_bss_tmp_disallowed_entry(wpa_s, tmp);
|
||||||
os_free(tmp);
|
|
||||||
wpa_set_driver_tmp_disallow_list(wpa_s);
|
wpa_set_driver_tmp_disallow_list(wpa_s);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8231,10 +8236,7 @@ int wpa_is_bss_tmp_disallowed(struct wpa_supplicant *wpa_s,
|
||||||
|
|
||||||
if (disallowed->rssi_threshold != 0 &&
|
if (disallowed->rssi_threshold != 0 &&
|
||||||
bss->level > disallowed->rssi_threshold) {
|
bss->level > disallowed->rssi_threshold) {
|
||||||
eloop_cancel_timeout(wpa_bss_tmp_disallow_timeout,
|
remove_bss_tmp_disallowed_entry(wpa_s, disallowed);
|
||||||
wpa_s, disallowed);
|
|
||||||
dl_list_del(&disallowed->list);
|
|
||||||
os_free(disallowed);
|
|
||||||
wpa_set_driver_tmp_disallow_list(wpa_s);
|
wpa_set_driver_tmp_disallow_list(wpa_s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue