From patchwork Fri Oct 1 20:33:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Rodriguez X-Patchwork-Id: 224852 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o91KY1fK017379 for ; Fri, 1 Oct 2010 20:34:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754381Ab0JAUd6 (ORCPT ); Fri, 1 Oct 2010 16:33:58 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:35415 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753278Ab0JAUdz (ORCPT ); Fri, 1 Oct 2010 16:33:55 -0400 Received: from mcgrof by bombadil.infradead.org with local (Exim 4.72 #1 (Red Hat Linux)) id 1P1mIj-0002tY-Pm; Fri, 01 Oct 2010 20:33:53 +0000 From: "Luis R. Rodriguez" To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, "Luis R. Rodriguez" , stable@kernel.org, Jouni Malinen , Paul Stewart , Amod Bodas , Johannes Berg , Vasanthakumar Thiagarajan Subject: [PATCH v2 2/3] mac80211: wait until completely disassociated before new association Date: Fri, 1 Oct 2010 16:33:52 -0400 Message-Id: <1285965233-11097-3-git-send-email-lrodriguez@atheros.com> X-Mailer: git-send-email 1.6.2.rc1.3.g81d3f In-Reply-To: <1285965233-11097-1-git-send-email-lrodriguez@atheros.com> References: <1285965233-11097-1-git-send-email-lrodriguez@atheros.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 01 Oct 2010 20:34:01 +0000 (UTC) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index daab0c6..7eff124 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -936,7 +936,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); - ifmgd->associated = NULL; memset(ifmgd->bssid, 0, ETH_ALEN); /* @@ -1007,6 +1006,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, del_timer_sync(&sdata->u.mgd.bcn_mon_timer); del_timer_sync(&sdata->u.mgd.timer); del_timer_sync(&sdata->u.mgd.chswitch_timer); + + ifmgd->associated = NULL; } void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, diff --git a/net/mac80211/work.c b/net/mac80211/work.c index ae344d1..268ac1d 100644 --- a/net/mac80211/work.c +++ b/net/mac80211/work.c @@ -513,6 +513,19 @@ ieee80211_associate(struct ieee80211_work *wk) { struct ieee80211_sub_if_data *sdata = wk->sdata; struct ieee80211_local *local = sdata->local; + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; + bool associated; + + mutex_lock(&ifmgd->mtx); + associated = !!ifmgd->associated; + mutex_unlock(&ifmgd->mtx); + + if (associated) { + printk(KERN_DEBUG "%s: delaying association with %pM as " + "we are still associated", + sdata->name, wk->filter_ta); + goto wait; + } wk->assoc.tries++; if (wk->assoc.tries > IEEE80211_ASSOC_MAX_TRIES) { @@ -534,6 +547,7 @@ ieee80211_associate(struct ieee80211_work *wk) sdata->name, wk->filter_ta, wk->assoc.tries); ieee80211_send_assoc(sdata, wk); +wait: wk->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; run_again(local, wk->timeout);