From 532f6b154e03b5fa222502098b5688a1784cc4e3 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 9 Jun 2020 10:00:02 -0500 Subject: [PATCH] station: Do not enter autoconnect_full erroneously MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a connection is initiated (via dbus) while a quick scan is in progress, the quick scan will be aborted. In this case, station_quick_scan_results will always transition to the AUTOCONNECT_FULL state regardless of whether it should or not. Fix this by making sure that we only enter AUTOCONNECT_FULL if we're still in the AUTOCONNECT_QUICK state. Reported-by: Alvin Šipraga --- src/station.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/station.c b/src/station.c index c532319a..ca6a0b8e 100644 --- a/src/station.c +++ b/src/station.c @@ -1059,15 +1059,13 @@ static bool station_quick_scan_results(int err, struct l_queue *bss_list, station_property_set_scanning(station, false); - if (err) { - station_enter_state(station, STATION_STATE_AUTOCONNECT_FULL); - - return false; - } + if (err) + goto done; autoconnect = station_is_autoconnecting(station); station_set_scan_results(station, bss_list, autoconnect); +done: if (station->state == STATION_STATE_AUTOCONNECT_QUICK) /* * If we're still in AUTOCONNECT_QUICK state, then autoconnect @@ -1075,7 +1073,7 @@ static bool station_quick_scan_results(int err, struct l_queue *bss_list, */ station_enter_state(station, STATION_STATE_AUTOCONNECT_FULL); - return true; + return err == 0; } static void station_quick_scan_triggered(int err, void *user_data)