diff options
author | Ilan Peer <ilan.peer@intel.com> | 2014-01-14 08:17:23 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-02-04 15:48:14 -0500 |
commit | 772f0389338cfcf96da1c178046dc7e1649ab554 (patch) | |
tree | 6d4f1c6ab6feeddf2f82159d6764e91c62c532cd /net/wireless/reg.c | |
parent | 52512072738c851896c8bfa31938eba1e9b9bc62 (diff) |
cfg80211: fix few minor issues in reg_process_hint()
Fix the following issues in reg_process_hint():
1. Add verification that wiphy is valid before processing
NL80211_REGDOMAIN_SET_BY_COUNTRY_IE.
2. Free the request in case of invalid initiator.
3. Remove WARN_ON check on reg_request->alpha2 as it is not a
pointer.
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r-- | net/wireless/reg.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 9b897fca7487..484facf00510 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -1683,17 +1683,9 @@ static void reg_process_hint(struct regulatory_request *reg_request) | |||
1683 | struct wiphy *wiphy = NULL; | 1683 | struct wiphy *wiphy = NULL; |
1684 | enum reg_request_treatment treatment; | 1684 | enum reg_request_treatment treatment; |
1685 | 1685 | ||
1686 | if (WARN_ON(!reg_request->alpha2)) | ||
1687 | return; | ||
1688 | |||
1689 | if (reg_request->wiphy_idx != WIPHY_IDX_INVALID) | 1686 | if (reg_request->wiphy_idx != WIPHY_IDX_INVALID) |
1690 | wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); | 1687 | wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); |
1691 | 1688 | ||
1692 | if (reg_request->initiator == NL80211_REGDOM_SET_BY_DRIVER && !wiphy) { | ||
1693 | kfree(reg_request); | ||
1694 | return; | ||
1695 | } | ||
1696 | |||
1697 | switch (reg_request->initiator) { | 1689 | switch (reg_request->initiator) { |
1698 | case NL80211_REGDOM_SET_BY_CORE: | 1690 | case NL80211_REGDOM_SET_BY_CORE: |
1699 | reg_process_hint_core(reg_request); | 1691 | reg_process_hint_core(reg_request); |
@@ -1706,20 +1698,29 @@ static void reg_process_hint(struct regulatory_request *reg_request) | |||
1706 | schedule_delayed_work(®_timeout, msecs_to_jiffies(3142)); | 1698 | schedule_delayed_work(®_timeout, msecs_to_jiffies(3142)); |
1707 | return; | 1699 | return; |
1708 | case NL80211_REGDOM_SET_BY_DRIVER: | 1700 | case NL80211_REGDOM_SET_BY_DRIVER: |
1701 | if (!wiphy) | ||
1702 | goto out_free; | ||
1709 | treatment = reg_process_hint_driver(wiphy, reg_request); | 1703 | treatment = reg_process_hint_driver(wiphy, reg_request); |
1710 | break; | 1704 | break; |
1711 | case NL80211_REGDOM_SET_BY_COUNTRY_IE: | 1705 | case NL80211_REGDOM_SET_BY_COUNTRY_IE: |
1706 | if (!wiphy) | ||
1707 | goto out_free; | ||
1712 | treatment = reg_process_hint_country_ie(wiphy, reg_request); | 1708 | treatment = reg_process_hint_country_ie(wiphy, reg_request); |
1713 | break; | 1709 | break; |
1714 | default: | 1710 | default: |
1715 | WARN(1, "invalid initiator %d\n", reg_request->initiator); | 1711 | WARN(1, "invalid initiator %d\n", reg_request->initiator); |
1716 | return; | 1712 | goto out_free; |
1717 | } | 1713 | } |
1718 | 1714 | ||
1719 | /* This is required so that the orig_* parameters are saved */ | 1715 | /* This is required so that the orig_* parameters are saved */ |
1720 | if (treatment == REG_REQ_ALREADY_SET && wiphy && | 1716 | if (treatment == REG_REQ_ALREADY_SET && wiphy && |
1721 | wiphy->regulatory_flags & REGULATORY_STRICT_REG) | 1717 | wiphy->regulatory_flags & REGULATORY_STRICT_REG) |
1722 | wiphy_update_regulatory(wiphy, reg_request->initiator); | 1718 | wiphy_update_regulatory(wiphy, reg_request->initiator); |
1719 | |||
1720 | return; | ||
1721 | |||
1722 | out_free: | ||
1723 | kfree(reg_request); | ||
1723 | } | 1724 | } |
1724 | 1725 | ||
1725 | /* | 1726 | /* |