aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 8a9b4d817ae6..ba439664c2e0 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4682,13 +4682,41 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
4682 ibss.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); 4682 ibss.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]);
4683 } 4683 }
4684 4684
4685 ibss.channel = ieee80211_get_channel(wiphy, 4685 if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) {
4686 nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ])); 4686 enum nl80211_channel_type channel_type;
4687
4688 channel_type = nla_get_u32(
4689 info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]);
4690 if (channel_type != NL80211_CHAN_NO_HT &&
4691 channel_type != NL80211_CHAN_HT20 &&
4692 channel_type != NL80211_CHAN_HT40MINUS &&
4693 channel_type != NL80211_CHAN_HT40PLUS)
4694 return -EINVAL;
4695
4696 if (channel_type != NL80211_CHAN_NO_HT &&
4697 !(wiphy->features & NL80211_FEATURE_HT_IBSS))
4698 return -EINVAL;
4699
4700 ibss.channel_type = channel_type;
4701 } else {
4702 ibss.channel_type = NL80211_CHAN_NO_HT;
4703 }
4704
4705 ibss.channel = rdev_freq_to_chan(rdev,
4706 nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]),
4707 ibss.channel_type);
4687 if (!ibss.channel || 4708 if (!ibss.channel ||
4688 ibss.channel->flags & IEEE80211_CHAN_NO_IBSS || 4709 ibss.channel->flags & IEEE80211_CHAN_NO_IBSS ||
4689 ibss.channel->flags & IEEE80211_CHAN_DISABLED) 4710 ibss.channel->flags & IEEE80211_CHAN_DISABLED)
4690 return -EINVAL; 4711 return -EINVAL;
4691 4712
4713 /* Both channels should be able to initiate communication */
4714 if ((ibss.channel_type == NL80211_CHAN_HT40PLUS ||
4715 ibss.channel_type == NL80211_CHAN_HT40MINUS) &&
4716 !cfg80211_can_beacon_sec_chan(&rdev->wiphy, ibss.channel,
4717 ibss.channel_type))
4718 return -EINVAL;
4719
4692 ibss.channel_fixed = !!info->attrs[NL80211_ATTR_FREQ_FIXED]; 4720 ibss.channel_fixed = !!info->attrs[NL80211_ATTR_FREQ_FIXED];
4693 ibss.privacy = !!info->attrs[NL80211_ATTR_PRIVACY]; 4721 ibss.privacy = !!info->attrs[NL80211_ATTR_PRIVACY];
4694 4722