From e374522827c92cf3ea8ea9df08160cc379f78e75 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 1 Dec 2014 17:49:19 +0200 Subject: [PATCH] Do not start new radio work on scan completion during ext work Externally triggered scan could result in a new radio work item getting started even when external radio work was in progress. Delay such start until the external work is completed. Signed-off-by: Jouni Malinen --- wpa_supplicant/ctrl_iface.c | 4 ++++ wpa_supplicant/wpa_supplicant.c | 5 +++++ wpa_supplicant/wpa_supplicant_i.h | 1 + 3 files changed, 10 insertions(+) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 3bbcc530e..2a9fe6aae 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -5976,6 +5976,7 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s) eapol_sm_notify_logoff(wpa_s->eapol, FALSE); radio_remove_works(wpa_s, NULL, 1); + wpa_s->ext_work_in_progress = 0; wpa_s->next_ssid = NULL; @@ -6029,6 +6030,7 @@ static void wpas_ctrl_radio_work_timeout(void *eloop_ctx, void *timeout_ctx) "Timing out external radio work %u (%s)", ework->id, work->type); wpa_msg(work->wpa_s, MSG_INFO, EXT_RADIO_WORK_TIMEOUT "%u", ework->id); + work->wpa_s->ext_work_in_progress = 0; radio_work_done(work); os_free(ework); } @@ -6050,6 +6052,7 @@ static void wpas_ctrl_radio_work_cb(struct wpa_radio_work *work, int deinit) wpa_dbg(work->wpa_s, MSG_DEBUG, "Starting external radio work %u (%s)", ework->id, ework->type); wpa_msg(work->wpa_s, MSG_INFO, EXT_RADIO_WORK_START "%u", ework->id); + work->wpa_s->ext_work_in_progress = 1; if (!ework->timeout) ework->timeout = 10; eloop_register_timeout(ework->timeout, 0, wpas_ctrl_radio_work_timeout, @@ -6129,6 +6132,7 @@ static int wpas_ctrl_radio_work_done(struct wpa_supplicant *wpa_s, char *cmd) "Completed external radio work %u (%s)", ework->id, ework->type); eloop_cancel_timeout(wpas_ctrl_radio_work_timeout, work, NULL); + wpa_s->ext_work_in_progress = 0; radio_work_done(work); os_free(ework); return 3; /* "OK\n" */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 5eae00b53..903bd0db3 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -3513,6 +3513,11 @@ void radio_work_check_next(struct wpa_supplicant *wpa_s) if (dl_list_empty(&radio->work)) return; + if (wpa_s->ext_work_in_progress) { + wpa_printf(MSG_DEBUG, + "External radio work in progress - delay start of pending item"); + return; + } eloop_cancel_timeout(radio_start_next_work, radio, NULL); eloop_register_timeout(0, 0, radio_start_next_work, radio, NULL); } diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index a5227ddfa..8370e5419 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -888,6 +888,7 @@ struct wpa_supplicant { unsigned int ext_mgmt_frame_handling:1; unsigned int ext_eapol_frame_io:1; unsigned int wmm_ac_supported:1; + unsigned int ext_work_in_progress:1; #ifdef CONFIG_WNM u8 wnm_dialog_token;