diff mbox

[1/1] P2P: Cancel pending action tx radio work on p2p_cancel

Message ID 2af15c04e05399f0b96ac1a0f265e1230360a5c0.1406638980.git.jithu@broadcom.com
State Accepted
Headers show

Commit Message

Jithu Jance July 29, 2014, 1:04 p.m. UTC
When p2p_cancel is invoked while the GO Neg action tx
was pending, the p2p_send_action_work was not getting
cleared.

Signed-off-by: Jithu Jance <jithu@broadcom.com>
---
 wpa_supplicant/p2p_supplicant.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

--
1.7.9.5

Comments

Jouni Malinen Aug. 10, 2014, 9:28 a.m. UTC | #1
On Tue, Jul 29, 2014 at 06:34:32PM +0530, Jithu Jance wrote:
> When p2p_cancel is invoked while the GO Neg action tx
> was pending, the p2p_send_action_work was not getting
> cleared.

Thanks, applied.
diff mbox

Patch

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index f1269ad..d64cd21 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -5684,6 +5684,29 @@  static void wpas_p2p_clear_pending_action_tx(struct wpa_supplicant *wpa_s)
 	if (!offchannel_pending_action_tx(wpa_s))
 		return;

+    if (wpa_s->p2p_send_action_work) {
+        struct send_action_work *awork;
+        awork = wpa_s->p2p_send_action_work->ctx;
+        if (awork->wait_time == 0) {
+            os_free(awork);
+            radio_work_done(wpa_s->p2p_send_action_work);
+            wpa_s->p2p_send_action_work = NULL;
+        } else {
+            /*
+             * In theory,   this should not be needed, but number of
+             * places in the P2P code is still using non-zero wait
+             * time for the last Action frame in the sequence and
+             * some of these do not call send_action_done().
+             */
+            eloop_cancel_timeout(wpas_p2p_send_action_work_timeout,
+                wpa_s, NULL);
+            eloop_register_timeout(
+                0, awork->wait_time * 1000,
+                wpas_p2p_send_action_work_timeout,
+                wpa_s, NULL);
+        }
+    }
+
 	wpa_printf(MSG_DEBUG, "P2P: Drop pending Action TX due to new "
 		   "operation request");
 	offchannel_clear_pending_action_tx(wpa_s);