driver_nl80211: cancel not yet started r-o-c

Johannes Berg johannes
Fri Sep 2 01:50:58 PDT 2011


From: Johannes Berg <johannes.berg at intel.com>

Currently, the following can happen:

1) P2P state machine requests R-O-C
2) user changes their mind and aborts
3) P2P state machine aborts R-O-C
4) driver_nl80211 rejects abort since there
   was no notification about the start yet
5) R-O-C period start notification from kernel
6) P2P state machine requests new R-O-C
7) this overlaps with old R-O-C -- iwlwifi driver
   can't handle that and returns -EBUSY
8) state machine stops dead in its tracks

The reason is that the abort isn't going through
properly. Instead of tracking whether a R-O-C is
active in driver_nl80211, track whether one was
requested to avoid this scenario.

Reported-by: Reinette Chatre <reinette.chatre at intel.com>
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
Reinette, this is from the logs you sent me. Unfortunately, it isn't
even the problem I was interested in -- I was interested in the one
where the soon-to-be P2P-client eventually gets -EBUSY, not when it
happens right away :-) Hopefully with this patch we get rid of one
possible scenario though ...


 src/drivers/driver_nl80211.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 233cdb2..d28f852 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1089,7 +1089,8 @@ static void mlme_event_remain_on_channel(struct wpa_driver_nl80211_data *drv,
 	if (cookie != drv->remain_on_chan_cookie)
 		return; /* not for us */
 
-	drv->pending_remain_on_chan = !cancel_event;
+	if (cancel_event)
+		drv->pending_remain_on_chan = 0;
 
 	os_memset(&data, 0, sizeof(data));
 	data.remain_on_channel.freq = freq;
@@ -6466,6 +6467,7 @@ static int wpa_driver_nl80211_remain_on_channel(void *priv, unsigned int freq,
 			   "0x%llx for freq=%u MHz duration=%u",
 			   (long long unsigned int) cookie, freq, duration);
 		drv->remain_on_chan_cookie = cookie;
+		drv->pending_remain_on_chan = 1;
 		return 0;
 	}
 	wpa_printf(MSG_DEBUG, "nl80211: Failed to request remain-on-channel "
-- 
1.7.5.4






More information about the Hostap mailing list