From: Sujith Manoharan <[email protected]>

Currently, when a station leaves an IBSS network, the
corresponding BSS is not dropped from cfg80211 if there are
other active stations in the network. But, the small
window that is present when trying to determine a station's
status based on IEEE80211_IBSS_MERGE_INTERVAL introduces
a race.

Instead of trying to keep the BSS, always remove it when
leaving an IBSS network. There is not much benefit to retain
the BSS entry since it will be added with a subsequent join
operation.

This fixes an issue where a dangling BSS entry causes ath9k
to wait for a beacon indefinitely.

Cc: <[email protected]>
Reported-by: Simon Wunderlich <[email protected]>
Signed-off-by: Sujith Manoharan <[email protected]>
---
 net/mac80211/ibss.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 771080e..e1688cd 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -688,17 +688,18 @@ static int ieee80211_sta_active_ibss(struct 
ieee80211_sub_if_data *sdata)
        return active;
 }
 
-static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata)
+static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata, 
bool leave)
 {
        struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
        struct ieee80211_local *local = sdata->local;
        struct cfg80211_bss *cbss;
        struct beacon_data *presp;
        struct sta_info *sta;
-       int active_ibss;
+       int active_ibss = 0;
        u16 capability;
 
-       active_ibss = ieee80211_sta_active_ibss(sdata);
+       if (!leave)
+               active_ibss = ieee80211_sta_active_ibss(sdata);
 
        if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) {
                capability = WLAN_CAPABILITY_IBSS;
@@ -765,7 +766,7 @@ static void ieee80211_csa_connection_drop_work(struct 
work_struct *work)
 
        sdata_lock(sdata);
 
-       ieee80211_ibss_disconnect(sdata);
+       ieee80211_ibss_disconnect(sdata, false);
        synchronize_rcu();
        skb_queue_purge(&sdata->skb_queue);
 
@@ -1721,7 +1722,7 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data 
*sdata)
 {
        struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
 
-       ieee80211_ibss_disconnect(sdata);
+       ieee80211_ibss_disconnect(sdata, true);
        ifibss->ssid_len = 0;
        memset(ifibss->bssid, 0, ETH_ALEN);
 
-- 
1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to