From a902d5a64b825a778992e26c0add98479e9c3b39 Mon Sep 17 00:00:00 2001 From: Constantin Musca Date: Fri, 12 Sep 2014 10:22:19 +0300 Subject: [PATCH] P2P: Stop driver listen in p2p_state_timeout() When a P2P timeout occurs and p2p_state_timeout is executed, the stop_listen function can be called besides setting in_listen to zero in cases where the driver is still in ROC. That should not really happen in normal cases, but it is possible for some drivers to extend the ROC duration. If that happens, the next start_listen request may get rejected with "P2P: Reject start_listen since p2p_listen_work already exists". Signed-off-by: Constantin Musca --- src/p2p/p2p.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index a5712eb56..f28629e92 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -3542,6 +3542,10 @@ static void p2p_state_timeout(void *eloop_ctx, void *timeout_ctx) p2p_dbg(p2p, "Timeout (state=%s)", p2p_state_txt(p2p->state)); p2p->in_listen = 0; + if (p2p->drv_in_listen) { + p2p_dbg(p2p, "Driver is still in listen state - stop it"); + p2p->cfg->stop_listen(p2p->cfg->cb_ctx); + } switch (p2p->state) { case P2P_IDLE: