]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Fix scan_state update in no pending scan state
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 5 Dec 2016 09:43:16 +0000 (11:43 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 5 Dec 2016 09:48:26 +0000 (11:48 +0200)
Commit adcd7c4b0bd02bead77f884f52782a813f5243bb ('nl80211: Support
vendor scan together with normal scan') made the drv->scan_state updates
for NL80211_CMD_NEW_SCAN_RESULTS and NL80211_CMD_SCAN_ABORTED
conditional on drv->last_scan_cmd being NL80211_CMD_TRIGGER_SCAN. This
missed the part about the possibility of last_scan_cmd == 0 and an
externally started cfg80211 scan is ending. This could leave
drv->scan_state into SCAN_STARTED state even after the scan was
completed. Consequently, hwsim test cases could get stuck in reset()
handler waiting for scan to terminate.

Fix this by updating drv->scan_state also in drv->last_scan_cmd == 0
case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/drivers/driver_nl80211_event.c

index c77e21ed49a0ed82df7ed9cea4126c75089bc1fe..994bc4c103b55aadb70e58709777cc5b81a2f66a 100644 (file)
@@ -2116,9 +2116,10 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd,
        case NL80211_CMD_NEW_SCAN_RESULTS:
                wpa_dbg(drv->ctx, MSG_DEBUG,
                        "nl80211: New scan results available");
+               if (drv->last_scan_cmd != NL80211_CMD_VENDOR)
+                       drv->scan_state = SCAN_COMPLETED;
                drv->scan_complete_events = 1;
                if (drv->last_scan_cmd == NL80211_CMD_TRIGGER_SCAN) {
-                       drv->scan_state = SCAN_COMPLETED;
                        eloop_cancel_timeout(wpa_driver_nl80211_scan_timeout,
                                             drv, drv->ctx);
                        drv->last_scan_cmd = 0;
@@ -2135,8 +2136,9 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd,
                break;
        case NL80211_CMD_SCAN_ABORTED:
                wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Scan aborted");
-               if (drv->last_scan_cmd == NL80211_CMD_TRIGGER_SCAN) {
+               if (drv->last_scan_cmd != NL80211_CMD_VENDOR)
                        drv->scan_state = SCAN_ABORTED;
+               if (drv->last_scan_cmd == NL80211_CMD_TRIGGER_SCAN) {
                        /*
                         * Need to indicate that scan results are available in
                         * order not to make wpa_supplicant stop its scanning.