P2P: Call normal SD query callback on RX/TX race

If the TX success response races with the RX frame then the state
machine was simply move to P2P_SD_DURING_FIND to continue the operation.
However, this does not take into account broadcast queries where the
callback handler updates the peer's sd_pending_bcast_queries.

Fix this by exporting the callback and calling it directly. This is
fine, as the operation is cancelled immediately afterwards, ensuring
that the callback is not called a second time.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
This commit is contained in:
Benjamin Berg 2024-04-17 15:45:24 +03:00 committed by Jouni Malinen
parent 9b1e0ab4e8
commit 7cf3ceadaa
3 changed files with 6 additions and 3 deletions

View file

@ -3332,7 +3332,7 @@ skip_sd:
} }
static void p2p_sd_cb(struct p2p_data *p2p, int success) void p2p_sd_query_cb(struct p2p_data *p2p, int success)
{ {
p2p_dbg(p2p, "Service Discovery Query TX callback: success=%d", p2p_dbg(p2p, "Service Discovery Query TX callback: success=%d",
success); success);
@ -3835,7 +3835,7 @@ void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
p2p_go_neg_conf_cb(p2p, result); p2p_go_neg_conf_cb(p2p, result);
break; break;
case P2P_PENDING_SD: case P2P_PENDING_SD:
p2p_sd_cb(p2p, success); p2p_sd_query_cb(p2p, success);
break; break;
case P2P_PENDING_PD: case P2P_PENDING_PD:
p2p_prov_disc_cb(p2p, success); p2p_prov_disc_cb(p2p, success);

View file

@ -899,6 +899,9 @@ void p2p_pref_channel_filter(const struct p2p_channels *a,
const struct weighted_pcl *freq_list, const struct weighted_pcl *freq_list,
unsigned int num_channels, unsigned int num_channels,
struct p2p_channels *res, bool go); struct p2p_channels *res, bool go);
void p2p_sd_query_cb(struct p2p_data *p2p, int success);
void p2p_dbg(struct p2p_data *p2p, const char *fmt, ...) void p2p_dbg(struct p2p_data *p2p, const char *fmt, ...)
PRINTF_FORMAT(2, 3); PRINTF_FORMAT(2, 3);
void p2p_info(struct p2p_data *p2p, const char *fmt, ...) void p2p_info(struct p2p_data *p2p, const char *fmt, ...)

View file

@ -502,7 +502,7 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
* received. */ * received. */
p2p_dbg(p2p, p2p_dbg(p2p,
"GAS Initial Request had not yet received TX status - process the response anyway"); "GAS Initial Request had not yet received TX status - process the response anyway");
p2p_set_state(p2p, P2P_SD_DURING_FIND); p2p_sd_query_cb(p2p, 1);
} }
p2p->cfg->send_action_done(p2p->cfg->cb_ctx); p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
p2p_clear_timeout(p2p); p2p_clear_timeout(p2p);