summaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-02 18:26:18 +0200
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:01:54 -0400
commit0a9b5e17952ec7ce938645a23ba29bcfdb66c8d9 (patch)
tree2df7380758211f107f3510cae6a96bad7b38db08 /net/wireless
parent19957bb399e2722719c0e20c9ae91cf8b6aaff04 (diff)
downloadkernel-crypto-0a9b5e17952ec7ce938645a23ba29bcfdb66c8d9.tar.gz
kernel-crypto-0a9b5e17952ec7ce938645a23ba29bcfdb66c8d9.tar.xz
kernel-crypto-0a9b5e17952ec7ce938645a23ba29bcfdb66c8d9.zip
cfg80211: refuse authenticating to same BSSID twice
It is possible that there are different BSS structs with the same BSSID, but we cannot authenticate with multiple of them them because we need the BSSID to be unique for deauthenticating/disassociating. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/mlme.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 1a92bf7597b..020f33b3846 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -278,6 +278,21 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *bss;
int i, err, slot = -1, nfree = 0;
+ if (wdev->current_bss &&
+ memcmp(bssid, wdev->current_bss->pub.bssid, ETH_ALEN) == 0)
+ return -EALREADY;
+
+ for (i = 0; i < MAX_AUTH_BSSES; i++) {
+ if (wdev->authtry_bsses[i] &&
+ memcmp(bssid, wdev->authtry_bsses[i]->pub.bssid,
+ ETH_ALEN) == 0)
+ return -EALREADY;
+ if (wdev->auth_bsses[i] &&
+ memcmp(bssid, wdev->auth_bsses[i]->pub.bssid,
+ ETH_ALEN) == 0)
+ return -EALREADY;
+ }
+
memset(&req, 0, sizeof(req));
req.ie = ie;
@@ -291,13 +306,6 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
bss = bss_from_pub(req.bss);
for (i = 0; i < MAX_AUTH_BSSES; i++) {
- if (bss == wdev->auth_bsses[i]) {
- err = -EALREADY;
- goto out;
- }
- }
-
- for (i = 0; i < MAX_AUTH_BSSES; i++) {
if (!wdev->auth_bsses[i] && !wdev->authtry_bsses[i]) {
slot = i;
nfree++;