From patchwork Wed Dec 2 11:43:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 64245 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 nB2BmLMN016192 for ; Wed, 2 Dec 2009 11:48:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752496AbZLBLsO (ORCPT ); Wed, 2 Dec 2009 06:48:14 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752477AbZLBLsO (ORCPT ); Wed, 2 Dec 2009 06:48:14 -0500 Received: from xc.sipsolutions.net ([83.246.72.84]:55880 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752446AbZLBLsN (ORCPT ); Wed, 2 Dec 2009 06:48:13 -0500 Received: by sipsolutions.net with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NFngx-0006Du-HP; Wed, 02 Dec 2009 12:48:19 +0100 Message-Id: <20091202114646.607546955@sipsolutions.net> User-Agent: quilt/0.48-1 Date: Wed, 02 Dec 2009 12:43:42 +0100 From: Johannes Berg To: John Linville Cc: linux-wireless@vger.kernel.org Subject: [PATCH 1/6] cfg80211: avoid sending spurious deauth to userspace References: <20091202114341.088046714@sipsolutions.net> Content-Disposition: inline; filename=020-cfg80211-avoid-spurious-events.patch Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org --- wireless-testing.orig/net/wireless/mlme.c 2009-12-01 18:26:53.000000000 +0100 +++ wireless-testing/net/wireless/mlme.c 2009-12-01 18:26:59.000000000 +0100 @@ -137,22 +137,23 @@ void __cfg80211_send_deauth(struct net_d struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; const u8 *bssid = mgmt->bssid; int i; + bool found = false; ASSERT_WDEV_LOCK(wdev); - nl80211_send_deauth(rdev, dev, buf, len, GFP_KERNEL); - if (wdev->current_bss && memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) { cfg80211_unhold_bss(wdev->current_bss); cfg80211_put_bss(&wdev->current_bss->pub); wdev->current_bss = NULL; + found = true; } else for (i = 0; i < MAX_AUTH_BSSES; i++) { if (wdev->auth_bsses[i] && memcmp(wdev->auth_bsses[i]->pub.bssid, bssid, ETH_ALEN) == 0) { cfg80211_unhold_bss(wdev->auth_bsses[i]); cfg80211_put_bss(&wdev->auth_bsses[i]->pub); wdev->auth_bsses[i] = NULL; + found = true; break; } if (wdev->authtry_bsses[i] && @@ -160,10 +161,16 @@ void __cfg80211_send_deauth(struct net_d cfg80211_unhold_bss(wdev->authtry_bsses[i]); cfg80211_put_bss(&wdev->authtry_bsses[i]->pub); wdev->authtry_bsses[i] = NULL; + found = true; break; } } + if (!found) + return; + + nl80211_send_deauth(rdev, dev, buf, len, GFP_KERNEL); + if (wdev->sme_state == CFG80211_SME_CONNECTED) { u16 reason_code; bool from_ap;