}
-static void dpp_tcp_send_conn_status_msg(struct dpp_connection *conn,
+static void dpp_tcp_send_conn_status_msg(struct dpp_global *dpp,
+ struct dpp_connection *conn,
enum dpp_status_error result,
const u8 *ssid, size_t ssid_len,
const char *channel_list)
struct dpp_authentication *auth = conn->auth;
int res;
struct wpabuf *msg;
+ struct dpp_connection *c;
auth->conn_status_requested = 0;
return;
}
- /* This exchange will be terminated in the TX status handler */
- conn->on_tcp_tx_complete_remove = 1;
+ /* conn might have been removed during the dpp_tcp_send_msg() call, so
+ * need to check that it is still present before modifying it. */
+ dl_list_for_each(c, &dpp->tcp_init, struct dpp_connection, list) {
+ if (conn == c) {
+ /* This exchange will be terminated in the TX status
+ * handler */
+ conn->on_tcp_tx_complete_remove = 1;
+ break;
+ }
+ }
}
dl_list_for_each(conn, &dpp->tcp_init, struct dpp_connection, list) {
if (conn->auth && conn->auth->conn_status_requested) {
- dpp_tcp_send_conn_status_msg(conn, result, ssid,
+ dpp_tcp_send_conn_status_msg(dpp, conn, result, ssid,
ssid_len, channel_list);
break;
}