P2P: Fix remain-on-channel abort race
authorJohannes Berg <johannes.berg@intel.com>
Sun, 10 Oct 2010 14:52:13 +0000 (17:52 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 10 Oct 2010 14:52:13 +0000 (17:52 +0300)
When the P2P state machine requests a remain- on-channel, there's a
potential race where it can then request a stop before the r-o-c has
actually started, in which case the stop will not be processed. Fix
that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
wpa_supplicant/p2p_supplicant.c

index da90c28..3fb872d 100644 (file)
@@ -1048,7 +1048,7 @@ static int wpas_start_listen(void *ctx, unsigned int freq,
 static void wpas_stop_listen(void *ctx)
 {
        struct wpa_supplicant *wpa_s = ctx;
-       if (wpa_s->off_channel_freq) {
+       if (wpa_s->off_channel_freq || wpa_s->roc_waiting_drv_freq) {
                wpa_drv_cancel_remain_on_channel(wpa_s);
                wpa_s->off_channel_freq = 0;
                wpa_s->roc_waiting_drv_freq = 0;