]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix listen state machine getting stuck in send_action() scheduled case
authorHu Wang <huw@codeaurora.org>
Wed, 13 Nov 2019 04:54:55 +0000 (12:54 +0800)
committerJouni Malinen <j@w1.fi>
Wed, 13 Nov 2019 21:59:37 +0000 (23:59 +0200)
Commit 947b5a1532f9 ("P2P: Stop listen state if Action frame TX is
needed on another channel") added an optimization for P2P response
transmission in certain concurrent operation cases. However, it did not
take into account possibility of the driver not being in listen
state (p2p->drv_in_listen == 0) and could end up getting stuck with the
P2P state machine in a manner that made the device not listen for
following messages. This showed up in following manner in the debug log:

P2P: Starting short listen state (state=SEARCH)
P2P: Driver ended Listen state (freq=2437)
process received frame and send a response
P2P: Stop listen on 0 MHz to allow a frame to be sent immediately on 2437 MHz
P2P: Clear timeout (state=SEARCH)
--> state machine stuck

Fix this by adding drv_in_listen > 0 condition for the optimization to
stop the listen operation in send_action() resulting in scheduled TX.

Fixes: 947b5a1532f9 ("P2P: Stop listen state if Action frame TX is needed on another channel")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/p2p/p2p.c

index 24e429c590b7f5ab9e217ef24ffd2845d0216dde..7c1a8a56666718de1d8c9236d765194314171d73 100644 (file)
@@ -4921,6 +4921,7 @@ int p2p_send_action(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
        res = p2p->cfg->send_action(p2p->cfg->cb_ctx, freq, dst, src, bssid,
                                    buf, len, wait_time, &scheduled);
        if (res == 0 && scheduled && p2p->in_listen && freq > 0 &&
+           p2p->drv_in_listen > 0 &&
            (unsigned int) p2p->drv_in_listen != freq) {
                p2p_dbg(p2p,
                        "Stop listen on %d MHz to allow a frame to be sent immediately on %d MHz",