P2P: Fix stopping on search after SD callback
authorKrishna Vamsi <vamsin@qti.qualcomm.com>
Wed, 4 Feb 2015 11:47:23 +0000 (17:17 +0530)
committerJouni Malinen <j@w1.fi>
Wed, 4 Feb 2015 18:46:47 +0000 (20:46 +0200)
If p2p_find_timeout triggers after starting SD but before getting TX
status for send action, unwanted search could get triggered again when
TX status arrives though p2p_find_timeout moved the state to P2P_IDLE by
then. p2p_continue_find() would then move the state to P2P_SEARCH again.
Do not trigger the find operation from this context if state is
P2P_IDLE to avoid this.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/p2p/p2p.c

index 2fcef6b..f050c4b 100644 (file)
@@ -3171,13 +3171,15 @@ static void p2p_sd_cb(struct p2p_data *p2p, int success)
                if (p2p->sd_peer)
                        p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
                p2p->sd_peer = NULL;
-               p2p_continue_find(p2p);
+               if (p2p->state != P2P_IDLE)
+                       p2p_continue_find(p2p);
                return;
        }
 
        if (p2p->sd_peer == NULL) {
                p2p_dbg(p2p, "No SD peer entry known");
-               p2p_continue_find(p2p);
+               if (p2p->state != P2P_IDLE)
+                       p2p_continue_find(p2p);
                return;
        }