diff options
Diffstat (limited to 'net/wireless/sme.c')
-rw-r--r-- | net/wireless/sme.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 8e2ef54ea714..4a8289f9b4f0 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -351,15 +351,13 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
351 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) | 351 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) |
352 | return; | 352 | return; |
353 | 353 | ||
354 | if (wdev->sme_state == CFG80211_SME_CONNECTED) | 354 | if (WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTING)) |
355 | nl80211_send_roamed(wiphy_to_dev(wdev->wiphy), dev, | 355 | return; |
356 | |||
357 | nl80211_send_connect_result(wiphy_to_dev(wdev->wiphy), dev, | ||
356 | bssid, req_ie, req_ie_len, | 358 | bssid, req_ie, req_ie_len, |
357 | resp_ie, resp_ie_len, GFP_KERNEL); | 359 | resp_ie, resp_ie_len, |
358 | else | 360 | status, GFP_KERNEL); |
359 | nl80211_send_connect_result(wiphy_to_dev(wdev->wiphy), dev, | ||
360 | bssid, req_ie, req_ie_len, | ||
361 | resp_ie, resp_ie_len, | ||
362 | status, GFP_KERNEL); | ||
363 | 361 | ||
364 | #ifdef CONFIG_WIRELESS_EXT | 362 | #ifdef CONFIG_WIRELESS_EXT |
365 | if (wextev) { | 363 | if (wextev) { |
@@ -392,18 +390,13 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
392 | wdev->current_bss = NULL; | 390 | wdev->current_bss = NULL; |
393 | } | 391 | } |
394 | 392 | ||
395 | if (status == WLAN_STATUS_SUCCESS && | ||
396 | wdev->sme_state == CFG80211_SME_IDLE) | ||
397 | goto success; | ||
398 | |||
399 | if (wdev->sme_state != CFG80211_SME_CONNECTING) | ||
400 | return; | ||
401 | |||
402 | if (wdev->conn) | 393 | if (wdev->conn) |
403 | wdev->conn->state = CFG80211_CONN_IDLE; | 394 | wdev->conn->state = CFG80211_CONN_IDLE; |
404 | 395 | ||
405 | if (status != WLAN_STATUS_SUCCESS) { | 396 | if (status != WLAN_STATUS_SUCCESS) { |
406 | wdev->sme_state = CFG80211_SME_IDLE; | 397 | wdev->sme_state = CFG80211_SME_IDLE; |
398 | if (wdev->conn) | ||
399 | kfree(wdev->conn->ie); | ||
407 | kfree(wdev->conn); | 400 | kfree(wdev->conn); |
408 | wdev->conn = NULL; | 401 | wdev->conn = NULL; |
409 | kfree(wdev->connect_keys); | 402 | kfree(wdev->connect_keys); |
@@ -412,7 +405,6 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
412 | return; | 405 | return; |
413 | } | 406 | } |
414 | 407 | ||
415 | success: | ||
416 | if (!bss) | 408 | if (!bss) |
417 | bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid, | 409 | bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid, |
418 | wdev->ssid, wdev->ssid_len, | 410 | wdev->ssid, wdev->ssid_len, |
@@ -458,7 +450,8 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
458 | return; | 450 | return; |
459 | 451 | ||
460 | ev->type = EVENT_CONNECT_RESULT; | 452 | ev->type = EVENT_CONNECT_RESULT; |
461 | memcpy(ev->cr.bssid, bssid, ETH_ALEN); | 453 | if (bssid) |
454 | memcpy(ev->cr.bssid, bssid, ETH_ALEN); | ||
462 | ev->cr.req_ie = ((u8 *)ev) + sizeof(*ev); | 455 | ev->cr.req_ie = ((u8 *)ev) + sizeof(*ev); |
463 | ev->cr.req_ie_len = req_ie_len; | 456 | ev->cr.req_ie_len = req_ie_len; |
464 | memcpy((void *)ev->cr.req_ie, req_ie, req_ie_len); | 457 | memcpy((void *)ev->cr.req_ie, req_ie, req_ie_len); |
@@ -789,6 +782,7 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev, | |||
789 | } | 782 | } |
790 | } | 783 | } |
791 | if (err) { | 784 | if (err) { |
785 | kfree(wdev->conn->ie); | ||
792 | kfree(wdev->conn); | 786 | kfree(wdev->conn); |
793 | wdev->conn = NULL; | 787 | wdev->conn = NULL; |
794 | wdev->sme_state = CFG80211_SME_IDLE; | 788 | wdev->sme_state = CFG80211_SME_IDLE; |
@@ -858,6 +852,7 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev, | |||
858 | (wdev->conn->state == CFG80211_CONN_SCANNING || | 852 | (wdev->conn->state == CFG80211_CONN_SCANNING || |
859 | wdev->conn->state == CFG80211_CONN_SCAN_AGAIN)) { | 853 | wdev->conn->state == CFG80211_CONN_SCAN_AGAIN)) { |
860 | wdev->sme_state = CFG80211_SME_IDLE; | 854 | wdev->sme_state = CFG80211_SME_IDLE; |
855 | kfree(wdev->conn->ie); | ||
861 | kfree(wdev->conn); | 856 | kfree(wdev->conn); |
862 | wdev->conn = NULL; | 857 | wdev->conn = NULL; |
863 | wdev->ssid_len = 0; | 858 | wdev->ssid_len = 0; |