diff options
Diffstat (limited to 'net/wireless/mlme.c')
-rw-r--r-- | net/wireless/mlme.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index c52ff59a3e96..266766b8d80b 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -23,7 +23,7 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss, | |||
23 | { | 23 | { |
24 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 24 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
25 | struct wiphy *wiphy = wdev->wiphy; | 25 | struct wiphy *wiphy = wdev->wiphy; |
26 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 26 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
27 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; | 27 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; |
28 | u8 *ie = mgmt->u.assoc_resp.variable; | 28 | u8 *ie = mgmt->u.assoc_resp.variable; |
29 | int ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); | 29 | int ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); |
@@ -54,7 +54,7 @@ EXPORT_SYMBOL(cfg80211_rx_assoc_resp); | |||
54 | static void cfg80211_process_auth(struct wireless_dev *wdev, | 54 | static void cfg80211_process_auth(struct wireless_dev *wdev, |
55 | const u8 *buf, size_t len) | 55 | const u8 *buf, size_t len) |
56 | { | 56 | { |
57 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 57 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
58 | 58 | ||
59 | nl80211_send_rx_auth(rdev, wdev->netdev, buf, len, GFP_KERNEL); | 59 | nl80211_send_rx_auth(rdev, wdev->netdev, buf, len, GFP_KERNEL); |
60 | cfg80211_sme_rx_auth(wdev, buf, len); | 60 | cfg80211_sme_rx_auth(wdev, buf, len); |
@@ -63,7 +63,7 @@ static void cfg80211_process_auth(struct wireless_dev *wdev, | |||
63 | static void cfg80211_process_deauth(struct wireless_dev *wdev, | 63 | static void cfg80211_process_deauth(struct wireless_dev *wdev, |
64 | const u8 *buf, size_t len) | 64 | const u8 *buf, size_t len) |
65 | { | 65 | { |
66 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 66 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
67 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; | 67 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; |
68 | const u8 *bssid = mgmt->bssid; | 68 | const u8 *bssid = mgmt->bssid; |
69 | u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); | 69 | u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); |
@@ -82,7 +82,7 @@ static void cfg80211_process_deauth(struct wireless_dev *wdev, | |||
82 | static void cfg80211_process_disassoc(struct wireless_dev *wdev, | 82 | static void cfg80211_process_disassoc(struct wireless_dev *wdev, |
83 | const u8 *buf, size_t len) | 83 | const u8 *buf, size_t len) |
84 | { | 84 | { |
85 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); | 85 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
86 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; | 86 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; |
87 | const u8 *bssid = mgmt->bssid; | 87 | const u8 *bssid = mgmt->bssid; |
88 | u16 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); | 88 | u16 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); |
@@ -123,7 +123,7 @@ void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr) | |||
123 | { | 123 | { |
124 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 124 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
125 | struct wiphy *wiphy = wdev->wiphy; | 125 | struct wiphy *wiphy = wdev->wiphy; |
126 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 126 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
127 | 127 | ||
128 | trace_cfg80211_send_auth_timeout(dev, addr); | 128 | trace_cfg80211_send_auth_timeout(dev, addr); |
129 | 129 | ||
@@ -136,7 +136,7 @@ void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss) | |||
136 | { | 136 | { |
137 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 137 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
138 | struct wiphy *wiphy = wdev->wiphy; | 138 | struct wiphy *wiphy = wdev->wiphy; |
139 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 139 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
140 | 140 | ||
141 | trace_cfg80211_send_assoc_timeout(dev, bss->bssid); | 141 | trace_cfg80211_send_assoc_timeout(dev, bss->bssid); |
142 | 142 | ||
@@ -172,7 +172,7 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, | |||
172 | const u8 *tsc, gfp_t gfp) | 172 | const u8 *tsc, gfp_t gfp) |
173 | { | 173 | { |
174 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | 174 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; |
175 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 175 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
176 | #ifdef CONFIG_CFG80211_WEXT | 176 | #ifdef CONFIG_CFG80211_WEXT |
177 | union iwreq_data wrqu; | 177 | union iwreq_data wrqu; |
178 | char *buf = kmalloc(128, gfp); | 178 | char *buf = kmalloc(128, gfp); |
@@ -233,14 +233,8 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, | |||
233 | if (!req.bss) | 233 | if (!req.bss) |
234 | return -ENOENT; | 234 | return -ENOENT; |
235 | 235 | ||
236 | err = cfg80211_can_use_chan(rdev, wdev, req.bss->channel, | ||
237 | CHAN_MODE_SHARED); | ||
238 | if (err) | ||
239 | goto out; | ||
240 | |||
241 | err = rdev_auth(rdev, dev, &req); | 236 | err = rdev_auth(rdev, dev, &req); |
242 | 237 | ||
243 | out: | ||
244 | cfg80211_put_bss(&rdev->wiphy, req.bss); | 238 | cfg80211_put_bss(&rdev->wiphy, req.bss); |
245 | return err; | 239 | return err; |
246 | } | 240 | } |
@@ -306,16 +300,10 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev, | |||
306 | if (!req->bss) | 300 | if (!req->bss) |
307 | return -ENOENT; | 301 | return -ENOENT; |
308 | 302 | ||
309 | err = cfg80211_can_use_chan(rdev, wdev, chan, CHAN_MODE_SHARED); | ||
310 | if (err) | ||
311 | goto out; | ||
312 | |||
313 | err = rdev_assoc(rdev, dev, req); | 303 | err = rdev_assoc(rdev, dev, req); |
314 | if (!err) | 304 | if (!err) |
315 | cfg80211_hold_bss(bss_from_pub(req->bss)); | 305 | cfg80211_hold_bss(bss_from_pub(req->bss)); |
316 | 306 | else | |
317 | out: | ||
318 | if (err) | ||
319 | cfg80211_put_bss(&rdev->wiphy, req->bss); | 307 | cfg80211_put_bss(&rdev->wiphy, req->bss); |
320 | 308 | ||
321 | return err; | 309 | return err; |
@@ -414,7 +402,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid, | |||
414 | int match_len) | 402 | int match_len) |
415 | { | 403 | { |
416 | struct wiphy *wiphy = wdev->wiphy; | 404 | struct wiphy *wiphy = wdev->wiphy; |
417 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 405 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
418 | struct cfg80211_mgmt_registration *reg, *nreg; | 406 | struct cfg80211_mgmt_registration *reg, *nreg; |
419 | int err = 0; | 407 | int err = 0; |
420 | u16 mgmt_type; | 408 | u16 mgmt_type; |
@@ -473,7 +461,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid, | |||
473 | void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid) | 461 | void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid) |
474 | { | 462 | { |
475 | struct wiphy *wiphy = wdev->wiphy; | 463 | struct wiphy *wiphy = wdev->wiphy; |
476 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 464 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
477 | struct cfg80211_mgmt_registration *reg, *tmp; | 465 | struct cfg80211_mgmt_registration *reg, *tmp; |
478 | 466 | ||
479 | spin_lock_bh(&wdev->mgmt_registrations_lock); | 467 | spin_lock_bh(&wdev->mgmt_registrations_lock); |
@@ -620,7 +608,7 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm, | |||
620 | const u8 *buf, size_t len, u32 flags, gfp_t gfp) | 608 | const u8 *buf, size_t len, u32 flags, gfp_t gfp) |
621 | { | 609 | { |
622 | struct wiphy *wiphy = wdev->wiphy; | 610 | struct wiphy *wiphy = wdev->wiphy; |
623 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 611 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
624 | struct cfg80211_mgmt_registration *reg; | 612 | struct cfg80211_mgmt_registration *reg; |
625 | const struct ieee80211_txrx_stypes *stypes = | 613 | const struct ieee80211_txrx_stypes *stypes = |
626 | &wiphy->mgmt_stypes[wdev->iftype]; | 614 | &wiphy->mgmt_stypes[wdev->iftype]; |
@@ -739,7 +727,7 @@ void cfg80211_radar_event(struct wiphy *wiphy, | |||
739 | struct cfg80211_chan_def *chandef, | 727 | struct cfg80211_chan_def *chandef, |
740 | gfp_t gfp) | 728 | gfp_t gfp) |
741 | { | 729 | { |
742 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 730 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
743 | unsigned long timeout; | 731 | unsigned long timeout; |
744 | 732 | ||
745 | trace_cfg80211_radar_event(wiphy, chandef); | 733 | trace_cfg80211_radar_event(wiphy, chandef); |
@@ -764,7 +752,7 @@ void cfg80211_cac_event(struct net_device *netdev, | |||
764 | { | 752 | { |
765 | struct wireless_dev *wdev = netdev->ieee80211_ptr; | 753 | struct wireless_dev *wdev = netdev->ieee80211_ptr; |
766 | struct wiphy *wiphy = wdev->wiphy; | 754 | struct wiphy *wiphy = wdev->wiphy; |
767 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 755 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
768 | unsigned long timeout; | 756 | unsigned long timeout; |
769 | 757 | ||
770 | trace_cfg80211_cac_event(netdev, event); | 758 | trace_cfg80211_cac_event(netdev, event); |