From patchwork Thu Jul 23 23:37:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Rodriguez X-Patchwork-Id: 37042 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6NNbqtM027567 for ; Thu, 23 Jul 2009 23:37:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753927AbZGWXhu (ORCPT ); Thu, 23 Jul 2009 19:37:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753990AbZGWXhu (ORCPT ); Thu, 23 Jul 2009 19:37:50 -0400 Received: from mail.atheros.com ([12.36.123.2]:13981 "EHLO mail.atheros.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752323AbZGWXht (ORCPT ); Thu, 23 Jul 2009 19:37:49 -0400 Received: from mail.atheros.com ([10.10.20.104]) by sidewinder.atheros.com for ; Thu, 23 Jul 2009 16:37:50 -0700 Received: from smtp.atheros.com (10.10.18.125) by SC1EXHC-01.global.atheros.com (10.10.20.106) with Microsoft SMTP Server (TLS) id 8.0.751.0; Thu, 23 Jul 2009 16:37:49 -0700 Received: by smtp.atheros.com (sSMTP sendmail emulation); Thu, 23 Jul 2009 16:37:48 -0700 From: "Luis R. Rodriguez" To: , CC: , , "Luis R. Rodriguez" , Christian Lamparter , Larry Finger Subject: [PATCH] mac80211: fix MLME issuing of probe requests while scanning Date: Thu, 23 Jul 2009 16:37:47 -0700 Message-ID: <1248392267-32086-1-git-send-email-lrodriguez@atheros.com> X-Mailer: git-send-email 1.6.3.3 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org We were issuing probe requests to the associated AP on the wrong band by having our beacon timer loss trigger while we are scanning. When we would scan the timer could hit and force us to send a probe request to the AP but with a chance we'd be on the wrong band. This leads to finding no usable bitrate but we should not get so far on the xmit path. We should not be trying to send these probe request frames so prevent ieee80211_mgd_probe_ap() from sending these. As it turns out all callers of ieee80211_mgd_probe_ap() need this check so we just move the scan check there. This means we can remove the recenlty added check during ieee80211_sta_monitor_work(). Additionally we now fix a race condition added by the patch "mac80211: do not monitor the connection while scanning" which had the same check in ieee80211_sta_conn_mon_timer(). The race happens because the timer routine *does* a valid check for scanning but after it queues work into the mac80211 workqueue the work callback can kick off with scanning enabled and cause the same issue we were trying to avoid. The more appropriate solution would be to disable the respective timers during scan and re-enable them after scan but requires more complex code and testing. Cc: Christian Lamparter Cc: Larry Finger Reported-by: Fabio Rossi Signed-off-by: Luis R. Rodriguez --- net/mac80211/mlme.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 523c0d9..db0b4b2 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -1166,6 +1166,9 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata, if (!netif_running(sdata->dev)) return; + if (sdata->local->sw_scanning || sdata->local->hw_scanning) + return; + mutex_lock(&ifmgd->mtx); if (!ifmgd->associated) @@ -2213,9 +2216,6 @@ static void ieee80211_sta_monitor_work(struct work_struct *work) container_of(work, struct ieee80211_sub_if_data, u.mgd.monitor_work); - if (sdata->local->sw_scanning || sdata->local->hw_scanning) - return; - ieee80211_mgd_probe_ap(sdata, false); }