mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
drivers/net: Fix crash in wifi_sim disconnect.
Add WLAN_STA_STATE_DISCONNECTED state to prevent race conditions or invalid state handling during disconnect. Signed-off-by: liqinhui <liqinhui@xiaomi.com>
This commit is contained in:
parent
a35dcd82e3
commit
58110f3d1a
1 changed files with 3 additions and 0 deletions
|
|
@ -146,6 +146,7 @@ enum WLAN_STA_STATE_E
|
|||
WLAN_STA_STATE_INIT,
|
||||
WLAN_STA_STATE_CONNECTING,
|
||||
WLAN_STA_STATE_CONNECTED,
|
||||
WLAN_STA_STATE_DISCONNECTED,
|
||||
};
|
||||
|
||||
enum WLAN_STA_CONNERR_E
|
||||
|
|
@ -915,6 +916,8 @@ static int wifidriver_start_disconnect(FAR struct wifi_sim_s *wifidev)
|
|||
{
|
||||
if (wifidev->state == WLAN_STA_STATE_CONNECTED)
|
||||
{
|
||||
wifidev->state = WLAN_STA_STATE_DISCONNECTED;
|
||||
|
||||
/* free the connected_ap */
|
||||
|
||||
free(wifidev->connected_ap);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue