aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/sme.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/sme.c')
-rw-r--r--net/wireless/sme.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 1d3cfb1a3f28..81c8a10d743c 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -34,8 +34,10 @@ struct cfg80211_conn {
34 CFG80211_CONN_SCAN_AGAIN, 34 CFG80211_CONN_SCAN_AGAIN,
35 CFG80211_CONN_AUTHENTICATE_NEXT, 35 CFG80211_CONN_AUTHENTICATE_NEXT,
36 CFG80211_CONN_AUTHENTICATING, 36 CFG80211_CONN_AUTHENTICATING,
37 CFG80211_CONN_AUTH_FAILED,
37 CFG80211_CONN_ASSOCIATE_NEXT, 38 CFG80211_CONN_ASSOCIATE_NEXT,
38 CFG80211_CONN_ASSOCIATING, 39 CFG80211_CONN_ASSOCIATING,
40 CFG80211_CONN_ASSOC_FAILED,
39 CFG80211_CONN_DEAUTH, 41 CFG80211_CONN_DEAUTH,
40 CFG80211_CONN_CONNECTED, 42 CFG80211_CONN_CONNECTED,
41 } state; 43 } state;
@@ -164,6 +166,8 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev)
164 NULL, 0, 166 NULL, 0,
165 params->key, params->key_len, 167 params->key, params->key_len,
166 params->key_idx, NULL, 0); 168 params->key_idx, NULL, 0);
169 case CFG80211_CONN_AUTH_FAILED:
170 return -ENOTCONN;
167 case CFG80211_CONN_ASSOCIATE_NEXT: 171 case CFG80211_CONN_ASSOCIATE_NEXT:
168 BUG_ON(!rdev->ops->assoc); 172 BUG_ON(!rdev->ops->assoc);
169 wdev->conn->state = CFG80211_CONN_ASSOCIATING; 173 wdev->conn->state = CFG80211_CONN_ASSOCIATING;
@@ -188,10 +192,17 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev)
188 WLAN_REASON_DEAUTH_LEAVING, 192 WLAN_REASON_DEAUTH_LEAVING,
189 false); 193 false);
190 return err; 194 return err;
195 case CFG80211_CONN_ASSOC_FAILED:
196 cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
197 NULL, 0,
198 WLAN_REASON_DEAUTH_LEAVING, false);
199 return -ENOTCONN;
191 case CFG80211_CONN_DEAUTH: 200 case CFG80211_CONN_DEAUTH:
192 cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, 201 cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
193 NULL, 0, 202 NULL, 0,
194 WLAN_REASON_DEAUTH_LEAVING, false); 203 WLAN_REASON_DEAUTH_LEAVING, false);
204 /* free directly, disconnected event already sent */
205 cfg80211_sme_free(wdev);
195 return 0; 206 return 0;
196 default: 207 default:
197 return 0; 208 return 0;
@@ -371,7 +382,7 @@ bool cfg80211_sme_rx_assoc_resp(struct wireless_dev *wdev, u16 status)
371 return true; 382 return true;
372 } 383 }
373 384
374 wdev->conn->state = CFG80211_CONN_DEAUTH; 385 wdev->conn->state = CFG80211_CONN_ASSOC_FAILED;
375 schedule_work(&rdev->conn_work); 386 schedule_work(&rdev->conn_work);
376 return false; 387 return false;
377} 388}
@@ -383,7 +394,13 @@ void cfg80211_sme_deauth(struct wireless_dev *wdev)
383 394
384void cfg80211_sme_auth_timeout(struct wireless_dev *wdev) 395void cfg80211_sme_auth_timeout(struct wireless_dev *wdev)
385{ 396{
386 cfg80211_sme_free(wdev); 397 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
398
399 if (!wdev->conn)
400 return;
401
402 wdev->conn->state = CFG80211_CONN_AUTH_FAILED;
403 schedule_work(&rdev->conn_work);
387} 404}
388 405
389void cfg80211_sme_disassoc(struct wireless_dev *wdev) 406void cfg80211_sme_disassoc(struct wireless_dev *wdev)
@@ -399,7 +416,13 @@ void cfg80211_sme_disassoc(struct wireless_dev *wdev)
399 416
400void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev) 417void cfg80211_sme_assoc_timeout(struct wireless_dev *wdev)
401{ 418{
402 cfg80211_sme_disassoc(wdev); 419 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
420
421 if (!wdev->conn)
422 return;
423
424 wdev->conn->state = CFG80211_CONN_ASSOC_FAILED;
425 schedule_work(&rdev->conn_work);
403} 426}
404 427
405static int cfg80211_sme_connect(struct wireless_dev *wdev, 428static int cfg80211_sme_connect(struct wireless_dev *wdev,