P2P: Force clearing of p2p-send-action radio work on P2P_STOP_FIND

Make sure there is no P2P radio work remaining if P2P_STOP_FIND is used
to stop a P2P exchange.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2023-12-10 19:02:34 +02:00
parent fe26b7559f
commit 8920e03905

View file

@ -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) {
/*