diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index de597cbb0..3f9c2142e 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -7412,9 +7412,10 @@ int wpas_p2p_scan_result_text(const u8 *ies, size_t ies_len, char *buf, } -static void wpas_p2p_clear_pending_action_tx(struct wpa_supplicant *wpa_s) +static void wpas_p2p_clear_pending_action_tx(struct wpa_supplicant *wpa_s, + bool force) { - if (!offchannel_pending_action_tx(wpa_s)) + if (!offchannel_pending_action_tx(wpa_s) && !force) return; if (wpa_s->p2p_send_action_work) { @@ -7424,6 +7425,8 @@ static void wpas_p2p_clear_pending_action_tx(struct wpa_supplicant *wpa_s) offchannel_send_action_done(wpa_s); } + if (!offchannel_pending_action_tx(wpa_s)) + return; wpa_printf(MSG_DEBUG, "P2P: Drop pending Action TX due to new " "operation request"); offchannel_clear_pending_action_tx(wpa_s); @@ -7437,7 +7440,7 @@ int wpas_p2p_find(struct wpa_supplicant *wpa_s, unsigned int timeout, u8 seek_cnt, const char **seek_string, int freq, bool include_6ghz) { - wpas_p2p_clear_pending_action_tx(wpa_s); + wpas_p2p_clear_pending_action_tx(wpa_s, false); wpa_s->global->p2p_long_listen = 0; if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL || @@ -7483,7 +7486,7 @@ static void wpas_p2p_scan_res_ignore_search(struct wpa_supplicant *wpa_s, static void wpas_p2p_stop_find_oper(struct wpa_supplicant *wpa_s) { - wpas_p2p_clear_pending_action_tx(wpa_s); + wpas_p2p_clear_pending_action_tx(wpa_s, true); wpa_s->global->p2p_long_listen = 0; eloop_cancel_timeout(wpas_p2p_long_listen_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL); @@ -7528,7 +7531,7 @@ int wpas_p2p_listen(struct wpa_supplicant *wpa_s, unsigned int timeout) } wpa_supplicant_cancel_sched_scan(wpa_s); - wpas_p2p_clear_pending_action_tx(wpa_s); + wpas_p2p_clear_pending_action_tx(wpa_s, false); if (timeout == 0) { /*