aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorAntonio Quartulli <antonio@open-mesh.com>2013-06-11 08:20:00 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-06-11 09:01:24 -0400
commitf7aeb6fb1a3d6b09623b169518314bc7869fffec (patch)
tree279ba9442b1f9538ac89d5af4fd742caccaeaf36 /net/mac80211
parent3d124ea27ae2fc895f81725f0b4c7f3d9c733df4 (diff)
mac80211: make mgmt_tx accept a NULL channel
cfg80211 passes a NULL channel to mgmt_tx if the frame has to be sent on the one currently in use by the device. Make the implementation of mgmt_tx correctly handle this case. Fail if offchan is required. Signed-off-by: Antonio Quartulli <antonio@open-mesh.com> [fix RCU locking] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index cd6f35f6e714..64cf294c2b96 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2841,6 +2841,12 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
2841 return -EOPNOTSUPP; 2841 return -EOPNOTSUPP;
2842 } 2842 }
2843 2843
2844 /* configurations requiring offchan cannot work if no channel has been
2845 * specified
2846 */
2847 if (need_offchan && !chan)
2848 return -EINVAL;
2849
2844 mutex_lock(&local->mtx); 2850 mutex_lock(&local->mtx);
2845 2851
2846 /* Check if the operating channel is the requested channel */ 2852 /* Check if the operating channel is the requested channel */
@@ -2850,10 +2856,15 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
2850 rcu_read_lock(); 2856 rcu_read_lock();
2851 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 2857 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2852 2858
2853 if (chanctx_conf) 2859 if (chanctx_conf) {
2854 need_offchan = chan != chanctx_conf->def.chan; 2860 need_offchan = chan && (chan != chanctx_conf->def.chan);
2855 else 2861 } else if (!chan) {
2862 ret = -EINVAL;
2863 rcu_read_unlock();
2864 goto out_unlock;
2865 } else {
2856 need_offchan = true; 2866 need_offchan = true;
2867 }
2857 rcu_read_unlock(); 2868 rcu_read_unlock();
2858 } 2869 }
2859 2870