diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 3c295c866..7f90393fa 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -3379,6 +3379,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, if (!wpa_s->ap_iface) { wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); + wpa_s->scan_req = NORMAL_SCAN_REQ; wpa_supplicant_req_scan(wpa_s, 0, 0); } else wpa_supplicant_set_state(wpa_s, @@ -3395,6 +3396,11 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, if (wpa_s->p2p_group_interface == P2P_GROUP_INTERFACE_GO || (wpa_s->current_ssid && wpa_s->current_ssid->p2p_group && wpa_s->current_ssid->mode == WPAS_MODE_P2P_GO)) { + /* + * Mark interface disabled if this happens to end up not + * being removed as a separate P2P group interface. + */ + wpa_supplicant_set_state(wpa_s, WPA_INTERFACE_DISABLED); /* * The interface was externally disabled. Remove * it assuming an external entity will start a @@ -3405,6 +3411,10 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, wpas_p2p_interface_unavailable(wpa_s); else wpas_p2p_disconnect(wpa_s); + /* + * wpa_s instance may have been freed, so must not use + * it here anymore. + */ break; } if (wpa_s->p2p_scan_work && wpa_s->global->p2p &&