]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Do not leave P2P scan handler registered if scan fails
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 29 Sep 2011 13:52:23 +0000 (16:52 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 29 Sep 2011 13:52:23 +0000 (16:52 +0300)
If the initial attempt to start a scan for p2p_find fails, an error
is reported. However, the P2P scan handler and search state was
left behind. That can result in unexpected behavior when the next
non-P2P scan results are indicated. Avoid this by clearing the
P2P search state on failure.

src/p2p/p2p.c
wpa_supplicant/p2p_supplicant.c

index ed9f81aaa93375059a997503ce330057a2688732..c0c59a6f9c0a723c926ea57230e8307853356a6d 100644 (file)
@@ -907,6 +907,8 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
        } else {
                wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Failed to start "
                        "p2p_scan");
+               p2p_set_state(p2p, P2P_IDLE);
+               eloop_cancel_timeout(p2p_find_timeout, p2p, NULL);
        }
 
        return res;
index f0451d2c507e0414ce7381785248e24718d4a12d..9894bfeb39fe8e56f0c8a7e9a488fa99d5bcded8 100644 (file)
@@ -149,6 +149,9 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
 
        wpabuf_free(ies);
 
+       if (ret < 0)
+               wpa_s->scan_res_handler = NULL;
+
        return ret;
 }