Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Johannes Berg and committed by
John W. Linville
0a9b5e17 19957bb3

+15 -7
+15 -7
net/wireless/mlme.c
··· 278 278 struct cfg80211_internal_bss *bss; 279 279 int i, err, slot = -1, nfree = 0; 280 280 281 + if (wdev->current_bss && 282 + memcmp(bssid, wdev->current_bss->pub.bssid, ETH_ALEN) == 0) 283 + return -EALREADY; 284 + 285 + for (i = 0; i < MAX_AUTH_BSSES; i++) { 286 + if (wdev->authtry_bsses[i] && 287 + memcmp(bssid, wdev->authtry_bsses[i]->pub.bssid, 288 + ETH_ALEN) == 0) 289 + return -EALREADY; 290 + if (wdev->auth_bsses[i] && 291 + memcmp(bssid, wdev->auth_bsses[i]->pub.bssid, 292 + ETH_ALEN) == 0) 293 + return -EALREADY; 294 + } 295 + 281 296 memset(&req, 0, sizeof(req)); 282 297 283 298 req.ie = ie; ··· 304 289 return -ENOENT; 305 290 306 291 bss = bss_from_pub(req.bss); 307 - 308 - for (i = 0; i < MAX_AUTH_BSSES; i++) { 309 - if (bss == wdev->auth_bsses[i]) { 310 - err = -EALREADY; 311 - goto out; 312 - } 313 - } 314 292 315 293 for (i = 0; i < MAX_AUTH_BSSES; i++) { 316 294 if (!wdev->auth_bsses[i] && !wdev->authtry_bsses[i]) {