diff options
Diffstat (limited to 'net/wireless/wext-sme.c')
-rw-r--r-- | net/wireless/wext-sme.c | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c index e79cb5c0655a..14c9a2583ba0 100644 --- a/net/wireless/wext-sme.c +++ b/net/wireless/wext-sme.c | |||
@@ -54,8 +54,8 @@ int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, | |||
54 | if (wdev->wext.prev_bssid_valid) | 54 | if (wdev->wext.prev_bssid_valid) |
55 | prev_bssid = wdev->wext.prev_bssid; | 55 | prev_bssid = wdev->wext.prev_bssid; |
56 | 56 | ||
57 | err = __cfg80211_connect(rdev, wdev->netdev, | 57 | err = cfg80211_connect(rdev, wdev->netdev, |
58 | &wdev->wext.connect, ck, prev_bssid); | 58 | &wdev->wext.connect, ck, prev_bssid); |
59 | if (err) | 59 | if (err) |
60 | kfree(ck); | 60 | kfree(ck); |
61 | 61 | ||
@@ -87,12 +87,9 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev, | |||
87 | return -EINVAL; | 87 | return -EINVAL; |
88 | } | 88 | } |
89 | 89 | ||
90 | cfg80211_lock_rdev(rdev); | ||
91 | mutex_lock(&rdev->devlist_mtx); | ||
92 | mutex_lock(&rdev->sched_scan_mtx); | ||
93 | wdev_lock(wdev); | 90 | wdev_lock(wdev); |
94 | 91 | ||
95 | if (wdev->sme_state != CFG80211_SME_IDLE) { | 92 | if (wdev->conn) { |
96 | bool event = true; | 93 | bool event = true; |
97 | 94 | ||
98 | if (wdev->wext.connect.channel == chan) { | 95 | if (wdev->wext.connect.channel == chan) { |
@@ -103,8 +100,8 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev, | |||
103 | /* if SSID set, we'll try right again, avoid event */ | 100 | /* if SSID set, we'll try right again, avoid event */ |
104 | if (wdev->wext.connect.ssid_len) | 101 | if (wdev->wext.connect.ssid_len) |
105 | event = false; | 102 | event = false; |
106 | err = __cfg80211_disconnect(rdev, dev, | 103 | err = cfg80211_disconnect(rdev, dev, |
107 | WLAN_REASON_DEAUTH_LEAVING, event); | 104 | WLAN_REASON_DEAUTH_LEAVING, event); |
108 | if (err) | 105 | if (err) |
109 | goto out; | 106 | goto out; |
110 | } | 107 | } |
@@ -136,9 +133,6 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev, | |||
136 | err = cfg80211_mgd_wext_connect(rdev, wdev); | 133 | err = cfg80211_mgd_wext_connect(rdev, wdev); |
137 | out: | 134 | out: |
138 | wdev_unlock(wdev); | 135 | wdev_unlock(wdev); |
139 | mutex_unlock(&rdev->sched_scan_mtx); | ||
140 | mutex_unlock(&rdev->devlist_mtx); | ||
141 | cfg80211_unlock_rdev(rdev); | ||
142 | return err; | 136 | return err; |
143 | } | 137 | } |
144 | 138 | ||
@@ -190,14 +184,11 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev, | |||
190 | if (len > 0 && ssid[len - 1] == '\0') | 184 | if (len > 0 && ssid[len - 1] == '\0') |
191 | len--; | 185 | len--; |
192 | 186 | ||
193 | cfg80211_lock_rdev(rdev); | ||
194 | mutex_lock(&rdev->devlist_mtx); | ||
195 | mutex_lock(&rdev->sched_scan_mtx); | ||
196 | wdev_lock(wdev); | 187 | wdev_lock(wdev); |
197 | 188 | ||
198 | err = 0; | 189 | err = 0; |
199 | 190 | ||
200 | if (wdev->sme_state != CFG80211_SME_IDLE) { | 191 | if (wdev->conn) { |
201 | bool event = true; | 192 | bool event = true; |
202 | 193 | ||
203 | if (wdev->wext.connect.ssid && len && | 194 | if (wdev->wext.connect.ssid && len && |
@@ -208,8 +199,8 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev, | |||
208 | /* if SSID set now, we'll try to connect, avoid event */ | 199 | /* if SSID set now, we'll try to connect, avoid event */ |
209 | if (len) | 200 | if (len) |
210 | event = false; | 201 | event = false; |
211 | err = __cfg80211_disconnect(rdev, dev, | 202 | err = cfg80211_disconnect(rdev, dev, |
212 | WLAN_REASON_DEAUTH_LEAVING, event); | 203 | WLAN_REASON_DEAUTH_LEAVING, event); |
213 | if (err) | 204 | if (err) |
214 | goto out; | 205 | goto out; |
215 | } | 206 | } |
@@ -226,9 +217,6 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev, | |||
226 | err = cfg80211_mgd_wext_connect(rdev, wdev); | 217 | err = cfg80211_mgd_wext_connect(rdev, wdev); |
227 | out: | 218 | out: |
228 | wdev_unlock(wdev); | 219 | wdev_unlock(wdev); |
229 | mutex_unlock(&rdev->sched_scan_mtx); | ||
230 | mutex_unlock(&rdev->devlist_mtx); | ||
231 | cfg80211_unlock_rdev(rdev); | ||
232 | return err; | 220 | return err; |
233 | } | 221 | } |
234 | 222 | ||
@@ -287,12 +275,9 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev, | |||
287 | if (is_zero_ether_addr(bssid) || is_broadcast_ether_addr(bssid)) | 275 | if (is_zero_ether_addr(bssid) || is_broadcast_ether_addr(bssid)) |
288 | bssid = NULL; | 276 | bssid = NULL; |
289 | 277 | ||
290 | cfg80211_lock_rdev(rdev); | ||
291 | mutex_lock(&rdev->devlist_mtx); | ||
292 | mutex_lock(&rdev->sched_scan_mtx); | ||
293 | wdev_lock(wdev); | 278 | wdev_lock(wdev); |
294 | 279 | ||
295 | if (wdev->sme_state != CFG80211_SME_IDLE) { | 280 | if (wdev->conn) { |
296 | err = 0; | 281 | err = 0; |
297 | /* both automatic */ | 282 | /* both automatic */ |
298 | if (!bssid && !wdev->wext.connect.bssid) | 283 | if (!bssid && !wdev->wext.connect.bssid) |
@@ -303,8 +288,8 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev, | |||
303 | ether_addr_equal(bssid, wdev->wext.connect.bssid)) | 288 | ether_addr_equal(bssid, wdev->wext.connect.bssid)) |
304 | goto out; | 289 | goto out; |
305 | 290 | ||
306 | err = __cfg80211_disconnect(rdev, dev, | 291 | err = cfg80211_disconnect(rdev, dev, |
307 | WLAN_REASON_DEAUTH_LEAVING, false); | 292 | WLAN_REASON_DEAUTH_LEAVING, false); |
308 | if (err) | 293 | if (err) |
309 | goto out; | 294 | goto out; |
310 | } | 295 | } |
@@ -318,9 +303,6 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev, | |||
318 | err = cfg80211_mgd_wext_connect(rdev, wdev); | 303 | err = cfg80211_mgd_wext_connect(rdev, wdev); |
319 | out: | 304 | out: |
320 | wdev_unlock(wdev); | 305 | wdev_unlock(wdev); |
321 | mutex_unlock(&rdev->sched_scan_mtx); | ||
322 | mutex_unlock(&rdev->devlist_mtx); | ||
323 | cfg80211_unlock_rdev(rdev); | ||
324 | return err; | 306 | return err; |
325 | } | 307 | } |
326 | 308 | ||
@@ -382,9 +364,9 @@ int cfg80211_wext_siwgenie(struct net_device *dev, | |||
382 | wdev->wext.ie = ie; | 364 | wdev->wext.ie = ie; |
383 | wdev->wext.ie_len = ie_len; | 365 | wdev->wext.ie_len = ie_len; |
384 | 366 | ||
385 | if (wdev->sme_state != CFG80211_SME_IDLE) { | 367 | if (wdev->conn) { |
386 | err = __cfg80211_disconnect(rdev, dev, | 368 | err = cfg80211_disconnect(rdev, dev, |
387 | WLAN_REASON_DEAUTH_LEAVING, false); | 369 | WLAN_REASON_DEAUTH_LEAVING, false); |
388 | if (err) | 370 | if (err) |
389 | goto out; | 371 | goto out; |
390 | } | 372 | } |
@@ -420,8 +402,7 @@ int cfg80211_wext_siwmlme(struct net_device *dev, | |||
420 | switch (mlme->cmd) { | 402 | switch (mlme->cmd) { |
421 | case IW_MLME_DEAUTH: | 403 | case IW_MLME_DEAUTH: |
422 | case IW_MLME_DISASSOC: | 404 | case IW_MLME_DISASSOC: |
423 | err = __cfg80211_disconnect(rdev, dev, mlme->reason_code, | 405 | err = cfg80211_disconnect(rdev, dev, mlme->reason_code, true); |
424 | true); | ||
425 | break; | 406 | break; |
426 | default: | 407 | default: |
427 | err = -EOPNOTSUPP; | 408 | err = -EOPNOTSUPP; |