linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv3] mac80211: deinitialize ibss-internals after emptiness check
@ 2012-11-13 17:43 Simon Wunderlich
  2012-11-13 17:55 ` Simon Wunderlich
  2012-11-13 20:35 ` Johannes Berg
  0 siblings, 2 replies; 3+ messages in thread
From: Simon Wunderlich @ 2012-11-13 17:43 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, Simon Wunderlich, Ignacy Gawedzki, Johannes Berg

The check whether the IBSS is active and can be removed should be
performed before deinitializing the fields used for the check/search.
Otherwise, the configured BSS will not be found and removed properly.

To make it more clear for the future, rename sdata->u.ibss to the
local pointer ifibss which is used within the checks.

This behaviour was introduced by
f3209bea110cade12e2b133da8b8499689cb0e2e
("mac80211: fix IBSS teardown race")

Cc: Ignacy Gawedzki <i@lri.fr>
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
 net/mac80211/ibss.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index c7386b2..67774b0 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1156,10 +1156,6 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
 
 	mutex_lock(&sdata->u.ibss.mtx);
 
-	sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH;
-	memset(sdata->u.ibss.bssid, 0, ETH_ALEN);
-	sdata->u.ibss.ssid_len = 0;
-
 	active_ibss = ieee80211_sta_active_ibss(sdata);
 
 	if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) {
@@ -1180,6 +1176,10 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
 		}
 	}
 
+	ifibss->state = IEEE80211_IBSS_MLME_SEARCH;
+	memset(ifibss->bssid, 0, ETH_ALEN);
+	ifibss->ssid_len = 0;
+
 	sta_info_flush(sdata->local, sdata);
 
 	spin_lock_bh(&ifibss->incomplete_lock);
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCHv3] mac80211: deinitialize ibss-internals after emptiness check
  2012-11-13 17:43 [PATCHv3] mac80211: deinitialize ibss-internals after emptiness check Simon Wunderlich
@ 2012-11-13 17:55 ` Simon Wunderlich
  2012-11-13 20:35 ` Johannes Berg
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Wunderlich @ 2012-11-13 17:55 UTC (permalink / raw)
  To: Simon Wunderlich
  Cc: linux-wireless, linville, Simon Wunderlich, Ignacy Gawedzki,
	Johannes Berg

[-- Attachment #1: Type: text/plain, Size: 1803 bytes --]

Whoops, there was actually never a version one or two posted here ...
Please consider this version 1.

Sorry,
	Simon

On Tue, Nov 13, 2012 at 06:43:03PM +0100, Simon Wunderlich wrote:
> The check whether the IBSS is active and can be removed should be
> performed before deinitializing the fields used for the check/search.
> Otherwise, the configured BSS will not be found and removed properly.
> 
> To make it more clear for the future, rename sdata->u.ibss to the
> local pointer ifibss which is used within the checks.
> 
> This behaviour was introduced by
> f3209bea110cade12e2b133da8b8499689cb0e2e
> ("mac80211: fix IBSS teardown race")
> 
> Cc: Ignacy Gawedzki <i@lri.fr>
> Cc: Johannes Berg <johannes@sipsolutions.net>
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
>  net/mac80211/ibss.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
> index c7386b2..67774b0 100644
> --- a/net/mac80211/ibss.c
> +++ b/net/mac80211/ibss.c
> @@ -1156,10 +1156,6 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
>  
>  	mutex_lock(&sdata->u.ibss.mtx);
>  
> -	sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH;
> -	memset(sdata->u.ibss.bssid, 0, ETH_ALEN);
> -	sdata->u.ibss.ssid_len = 0;
> -
>  	active_ibss = ieee80211_sta_active_ibss(sdata);
>  
>  	if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) {
> @@ -1180,6 +1176,10 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
>  		}
>  	}
>  
> +	ifibss->state = IEEE80211_IBSS_MLME_SEARCH;
> +	memset(ifibss->bssid, 0, ETH_ALEN);
> +	ifibss->ssid_len = 0;
> +
>  	sta_info_flush(sdata->local, sdata);
>  
>  	spin_lock_bh(&ifibss->incomplete_lock);
> -- 
> 1.7.10
> 
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHv3] mac80211: deinitialize ibss-internals after emptiness check
  2012-11-13 17:43 [PATCHv3] mac80211: deinitialize ibss-internals after emptiness check Simon Wunderlich
  2012-11-13 17:55 ` Simon Wunderlich
@ 2012-11-13 20:35 ` Johannes Berg
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2012-11-13 20:35 UTC (permalink / raw)
  To: Simon Wunderlich
  Cc: linux-wireless, linville, Simon Wunderlich, Ignacy Gawedzki

On Tue, 2012-11-13 at 18:43 +0100, Simon Wunderlich wrote:
> The check whether the IBSS is active and can be removed should be
> performed before deinitializing the fields used for the check/search.
> Otherwise, the configured BSS will not be found and removed properly.
> 
> To make it more clear for the future, rename sdata->u.ibss to the
> local pointer ifibss which is used within the checks.
> 
> This behaviour was introduced by
> f3209bea110cade12e2b133da8b8499689cb0e2e
> ("mac80211: fix IBSS teardown race")

Applied.

johannes


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-13 20:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-13 17:43 [PATCHv3] mac80211: deinitialize ibss-internals after emptiness check Simon Wunderlich
2012-11-13 17:55 ` Simon Wunderlich
2012-11-13 20:35 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).