diff options
Diffstat (limited to 'net/wireless')
| -rw-r--r-- | net/wireless/core.c | 23 | ||||
| -rw-r--r-- | net/wireless/core.h | 3 | ||||
| -rw-r--r-- | net/wireless/ibss.c | 3 | ||||
| -rw-r--r-- | net/wireless/nl80211.c | 4 | ||||
| -rw-r--r-- | net/wireless/radiotap.c | 7 |
5 files changed, 27 insertions, 13 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index 67153964aad2..aff959e5a1b3 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
| @@ -566,18 +566,13 @@ int wiphy_register(struct wiphy *wiphy) | |||
| 566 | /* check and set up bitrates */ | 566 | /* check and set up bitrates */ |
| 567 | ieee80211_set_bitrate_flags(wiphy); | 567 | ieee80211_set_bitrate_flags(wiphy); |
| 568 | 568 | ||
| 569 | 569 | rtnl_lock(); | |
| 570 | res = device_add(&rdev->wiphy.dev); | 570 | res = device_add(&rdev->wiphy.dev); |
| 571 | if (res) | ||
| 572 | return res; | ||
| 573 | |||
| 574 | res = rfkill_register(rdev->rfkill); | ||
| 575 | if (res) { | 571 | if (res) { |
| 576 | device_del(&rdev->wiphy.dev); | 572 | rtnl_unlock(); |
| 577 | return res; | 573 | return res; |
| 578 | } | 574 | } |
| 579 | 575 | ||
| 580 | rtnl_lock(); | ||
| 581 | /* set up regulatory info */ | 576 | /* set up regulatory info */ |
| 582 | wiphy_regulatory_register(wiphy); | 577 | wiphy_regulatory_register(wiphy); |
| 583 | 578 | ||
| @@ -606,6 +601,15 @@ int wiphy_register(struct wiphy *wiphy) | |||
| 606 | 601 | ||
| 607 | rdev->wiphy.registered = true; | 602 | rdev->wiphy.registered = true; |
| 608 | rtnl_unlock(); | 603 | rtnl_unlock(); |
| 604 | |||
| 605 | res = rfkill_register(rdev->rfkill); | ||
| 606 | if (res) { | ||
| 607 | rfkill_destroy(rdev->rfkill); | ||
| 608 | rdev->rfkill = NULL; | ||
| 609 | wiphy_unregister(&rdev->wiphy); | ||
| 610 | return res; | ||
| 611 | } | ||
| 612 | |||
| 609 | return 0; | 613 | return 0; |
| 610 | } | 614 | } |
| 611 | EXPORT_SYMBOL(wiphy_register); | 615 | EXPORT_SYMBOL(wiphy_register); |
| @@ -640,7 +644,8 @@ void wiphy_unregister(struct wiphy *wiphy) | |||
| 640 | rtnl_unlock(); | 644 | rtnl_unlock(); |
| 641 | __count == 0; })); | 645 | __count == 0; })); |
| 642 | 646 | ||
| 643 | rfkill_unregister(rdev->rfkill); | 647 | if (rdev->rfkill) |
| 648 | rfkill_unregister(rdev->rfkill); | ||
| 644 | 649 | ||
| 645 | rtnl_lock(); | 650 | rtnl_lock(); |
| 646 | rdev->wiphy.registered = false; | 651 | rdev->wiphy.registered = false; |
| @@ -953,8 +958,6 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, | |||
| 953 | case NETDEV_PRE_UP: | 958 | case NETDEV_PRE_UP: |
| 954 | if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) | 959 | if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) |
| 955 | return notifier_from_errno(-EOPNOTSUPP); | 960 | return notifier_from_errno(-EOPNOTSUPP); |
| 956 | if (rfkill_blocked(rdev->rfkill)) | ||
| 957 | return notifier_from_errno(-ERFKILL); | ||
| 958 | ret = cfg80211_can_add_interface(rdev, wdev->iftype); | 961 | ret = cfg80211_can_add_interface(rdev, wdev->iftype); |
| 959 | if (ret) | 962 | if (ret) |
| 960 | return notifier_from_errno(ret); | 963 | return notifier_from_errno(ret); |
diff --git a/net/wireless/core.h b/net/wireless/core.h index 9ad43c619c54..3159e9c284c5 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
| @@ -411,6 +411,9 @@ static inline int | |||
| 411 | cfg80211_can_add_interface(struct cfg80211_registered_device *rdev, | 411 | cfg80211_can_add_interface(struct cfg80211_registered_device *rdev, |
| 412 | enum nl80211_iftype iftype) | 412 | enum nl80211_iftype iftype) |
| 413 | { | 413 | { |
| 414 | if (rfkill_blocked(rdev->rfkill)) | ||
| 415 | return -ERFKILL; | ||
| 416 | |||
| 414 | return cfg80211_can_change_interface(rdev, NULL, iftype); | 417 | return cfg80211_can_change_interface(rdev, NULL, iftype); |
| 415 | } | 418 | } |
| 416 | 419 | ||
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index 39bff7d36768..403fe29c024d 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c | |||
| @@ -263,6 +263,8 @@ int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, | |||
| 263 | if (chan->flags & IEEE80211_CHAN_DISABLED) | 263 | if (chan->flags & IEEE80211_CHAN_DISABLED) |
| 264 | continue; | 264 | continue; |
| 265 | wdev->wext.ibss.chandef.chan = chan; | 265 | wdev->wext.ibss.chandef.chan = chan; |
| 266 | wdev->wext.ibss.chandef.center_freq1 = | ||
| 267 | chan->center_freq; | ||
| 266 | break; | 268 | break; |
| 267 | } | 269 | } |
| 268 | 270 | ||
| @@ -347,6 +349,7 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev, | |||
| 347 | if (chan) { | 349 | if (chan) { |
| 348 | wdev->wext.ibss.chandef.chan = chan; | 350 | wdev->wext.ibss.chandef.chan = chan; |
| 349 | wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; | 351 | wdev->wext.ibss.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; |
| 352 | wdev->wext.ibss.chandef.center_freq1 = freq; | ||
| 350 | wdev->wext.ibss.channel_fixed = true; | 353 | wdev->wext.ibss.channel_fixed = true; |
| 351 | } else { | 354 | } else { |
| 352 | /* cfg80211_ibss_wext_join will pick one if needed */ | 355 | /* cfg80211_ibss_wext_join will pick one if needed */ |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index af8d84a4a5b2..626dc3b5fd8d 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -2421,7 +2421,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info) | |||
| 2421 | change = true; | 2421 | change = true; |
| 2422 | } | 2422 | } |
| 2423 | 2423 | ||
| 2424 | if (flags && (*flags & NL80211_MNTR_FLAG_ACTIVE) && | 2424 | if (flags && (*flags & MONITOR_FLAG_ACTIVE) && |
| 2425 | !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) | 2425 | !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) |
| 2426 | return -EOPNOTSUPP; | 2426 | return -EOPNOTSUPP; |
| 2427 | 2427 | ||
| @@ -2483,7 +2483,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) | |||
| 2483 | info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, | 2483 | info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, |
| 2484 | &flags); | 2484 | &flags); |
| 2485 | 2485 | ||
| 2486 | if (!err && (flags & NL80211_MNTR_FLAG_ACTIVE) && | 2486 | if (!err && (flags & MONITOR_FLAG_ACTIVE) && |
| 2487 | !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) | 2487 | !(rdev->wiphy.features & NL80211_FEATURE_ACTIVE_MONITOR)) |
| 2488 | return -EOPNOTSUPP; | 2488 | return -EOPNOTSUPP; |
| 2489 | 2489 | ||
diff --git a/net/wireless/radiotap.c b/net/wireless/radiotap.c index 7d604c06c3dc..a271c27fac77 100644 --- a/net/wireless/radiotap.c +++ b/net/wireless/radiotap.c | |||
| @@ -97,6 +97,10 @@ int ieee80211_radiotap_iterator_init( | |||
| 97 | struct ieee80211_radiotap_header *radiotap_header, | 97 | struct ieee80211_radiotap_header *radiotap_header, |
| 98 | int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns) | 98 | int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns) |
| 99 | { | 99 | { |
| 100 | /* check the radiotap header can actually be present */ | ||
| 101 | if (max_length < sizeof(struct ieee80211_radiotap_header)) | ||
| 102 | return -EINVAL; | ||
| 103 | |||
| 100 | /* Linux only supports version 0 radiotap format */ | 104 | /* Linux only supports version 0 radiotap format */ |
| 101 | if (radiotap_header->it_version) | 105 | if (radiotap_header->it_version) |
| 102 | return -EINVAL; | 106 | return -EINVAL; |
| @@ -131,7 +135,8 @@ int ieee80211_radiotap_iterator_init( | |||
| 131 | */ | 135 | */ |
| 132 | 136 | ||
| 133 | if ((unsigned long)iterator->_arg - | 137 | if ((unsigned long)iterator->_arg - |
| 134 | (unsigned long)iterator->_rtheader > | 138 | (unsigned long)iterator->_rtheader + |
| 139 | sizeof(uint32_t) > | ||
| 135 | (unsigned long)iterator->_max_length) | 140 | (unsigned long)iterator->_max_length) |
| 136 | return -EINVAL; | 141 | return -EINVAL; |
| 137 | } | 142 | } |
