From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, Arik Nemtsov <arik@wizery.com>,
Arik Nemtsov <arikx.nemtsov@intel.com>,
Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 04/10] mac80211: TDLS: deny ch-switch req on disallowed channels
Date: Wed, 8 Jul 2015 15:41:46 +0300 [thread overview]
Message-ID: <1436359312-26533-5-git-send-email-emmanuel.grumbach@intel.com> (raw)
In-Reply-To: <1436359312-26533-1-git-send-email-emmanuel.grumbach@intel.com>
From: Arik Nemtsov <arik@wizery.com>
If a TDLS station is not allowed to beacon on a channel, don't accept
a channel switch request to this channel.
Move channel building code up to avoid lockdep violations - reg_can_beacon
needs to take the wdev lock.
Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
net/mac80211/tdls.c | 49 +++++++++++++++++++++++++++++++------------------
1 file changed, 31 insertions(+), 18 deletions(-)
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index 91e86bf..aee701a 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -1737,6 +1737,31 @@ ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata,
return -EINVAL;
}
+ if (!elems.sec_chan_offs) {
+ chan_type = NL80211_CHAN_HT20;
+ } else {
+ switch (elems.sec_chan_offs->sec_chan_offs) {
+ case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
+ chan_type = NL80211_CHAN_HT40PLUS;
+ break;
+ case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
+ chan_type = NL80211_CHAN_HT40MINUS;
+ break;
+ default:
+ chan_type = NL80211_CHAN_HT20;
+ break;
+ }
+ }
+
+ cfg80211_chandef_create(&chandef, chan, chan_type);
+
+ /* we will be active on the TDLS link */
+ if (!cfg80211_reg_can_beacon_relax(sdata->local->hw.wiphy, &chandef,
+ sdata->wdev.iftype)) {
+ tdls_dbg(sdata, "TDLS chan switch to forbidden channel\n");
+ return -EINVAL;
+ }
+
mutex_lock(&local->sta_mtx);
sta = sta_info_get(sdata, tf->sa);
if (!sta || !test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) {
@@ -1757,27 +1782,15 @@ ieee80211_process_tdls_channel_switch_req(struct ieee80211_sub_if_data *sdata,
goto out;
}
- if (!sta->sta.ht_cap.ht_supported) {
- chan_type = NL80211_CHAN_NO_HT;
- } else if (!elems.sec_chan_offs) {
- chan_type = NL80211_CHAN_HT20;
- } else {
- switch (elems.sec_chan_offs->sec_chan_offs) {
- case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
- chan_type = NL80211_CHAN_HT40PLUS;
- break;
- case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
- chan_type = NL80211_CHAN_HT40MINUS;
- break;
- default:
- chan_type = NL80211_CHAN_HT20;
- break;
- }
+ /* peer should have known better */
+ if (!sta->sta.ht_cap.ht_supported && elems.sec_chan_offs &&
+ elems.sec_chan_offs->sec_chan_offs) {
+ tdls_dbg(sdata, "TDLS chan switch - wide chan unsupported\n");
+ ret = -ENOTSUPP;
+ goto out;
}
- cfg80211_chandef_create(&chandef, chan, chan_type);
params.chandef = &chandef;
-
params.switch_time = le16_to_cpu(elems.ch_sw_timing->switch_time);
params.switch_timeout = le16_to_cpu(elems.ch_sw_timing->switch_timeout);
--
2.1.4
next prev parent reply other threads:[~2015-07-08 12:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 12:41 [PATCH 00/10] random patches to mac80211 Emmanuel Grumbach
2015-07-08 12:41 ` [PATCH 01/10] mac80211: Add support for declaring MU-MIMO capability Emmanuel Grumbach
2015-07-08 12:41 ` [PATCH 02/10] cfg80211: use RTNL locked reg_can_beacon for IR-relaxation Emmanuel Grumbach
2015-07-17 13:18 ` Johannes Berg
2015-07-08 12:41 ` [PATCH 03/10] mac80211: TDLS: handle chan-switch in RTNL locked work Emmanuel Grumbach
2015-07-08 12:41 ` Emmanuel Grumbach [this message]
2015-07-08 12:41 ` [PATCH 05/10] mac80211: clear local->suspended before calling drv_resume() Emmanuel Grumbach
2015-07-17 13:45 ` Johannes Berg
2015-07-08 12:41 ` [PATCH 06/10] mac80211: remove ieee80211_aes_cmac_calculate_k1_k2() Emmanuel Grumbach
2015-07-17 13:43 ` Johannes Berg
2015-08-13 9:32 ` Johannes Berg
2015-07-08 12:41 ` [PATCH 07/10] mac80211: add possibility to advertise 802.11 FTM support Emmanuel Grumbach
2015-07-17 13:44 ` Johannes Berg
2015-07-08 12:41 ` [PATCH 08/10] mac80211: shut down interfaces before destroying interface list Emmanuel Grumbach
2015-07-17 9:16 ` Johannes Berg
2015-07-08 12:41 ` [PATCH 09/10] mac80211: allow drivers to set netdev hw_features Emmanuel Grumbach
2015-07-08 12:41 ` [PATCH 10/10] mac80211: enable changing netdev features with ethtool Emmanuel Grumbach
2015-07-17 13:46 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436359312-26533-5-git-send-email-emmanuel.grumbach@intel.com \
--to=emmanuel.grumbach@intel.com \
--cc=arik@wizery.com \
--cc=arikx.nemtsov@intel.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).