]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Drop unexpected connection event while disconnected
authorVamsi Krishna <vamsin@codeaurora.org>
Thu, 3 Dec 2020 16:45:29 +0000 (22:15 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 21 Dec 2020 12:06:52 +0000 (14:06 +0200)
If there is a disconnect command from wpa_supplicant immediately after
the driver sends a connection event to userspace but before that event
is received and processed by wpa_supplicant, wpa_supplicant processes
the disconnect command and a self-generated disconnected event first
followed by the connected event received from the driver. As a result
wpa_supplicant moves to the WPA_COMPLETED state.  Whereas the driver
processes the disconnect command received from wpa_supplicant after it
sends the connected event and moves to the disconnected state. Due to
this race between the disconnect command from wpa_supplicant and the
connected event from the driver, wpa_supplicant is moving to the
connected state though the driver is moving to the disconnected state
which results in abnormal functionality.

Ignore the connection event coming from the driver when wpa_supplicant
is not trying to connect after a disconnect command is issued but before
the next connect command is issued to fix the above mentioned race
condition.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/events.c

index 89e6e73069bf0095615a0678bd192891f2e80409..fa8f5e1c0ea6991ce614d1cec06a4154dc322a74 100644 (file)
@@ -4715,6 +4715,11 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                        break;
                }
 #endif /* CONFIG_TESTING_OPTIONS */
+               if (wpa_s->disconnected) {
+                       wpa_printf(MSG_INFO,
+                                  "Ignore unexpected EVENT_ASSOC in disconnected state");
+                       break;
+               }
                wpa_supplicant_event_assoc(wpa_s, data);
                wpa_s->assoc_status_code = WLAN_STATUS_SUCCESS;
                if (data &&