Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCHv3 1/4] mac80211: make mgmt_tx accept a NULL channel
@ 2013-06-05 14:34 Antonio Quartulli
  2013-06-05 14:34 ` [PATCHv3 2/4] brcm80211: make mgmt_tx in brcmfmac " Antonio Quartulli
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Antonio Quartulli @ 2013-06-05 14:34 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Antonio Quartulli

From: Antonio Quartulli <antonio@open-mesh.com>

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>
---
 net/mac80211/cfg.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 3062210..617c5c8 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2838,6 +2838,12 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
 		return -EOPNOTSUPP;
 	}
 
+	/* configurations requiring offchan cannot work if no channel has been
+	 * specified
+	 */
+	if (need_offchan && !chan)
+		return -EINVAL;
+
 	mutex_lock(&local->mtx);
 
 	/* Check if the operating channel is the requested channel */
@@ -2847,10 +2853,14 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
 		rcu_read_lock();
 		chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
 
-		if (chanctx_conf)
-			need_offchan = chan != chanctx_conf->def.chan;
-		else
+		if (chanctx_conf) {
+			need_offchan = chan && (chan != chanctx_conf->def.chan);
+		} else if (!chan) {
+			ret = -EINVAL;
+			goto out_unlock;
+		} else {
 			need_offchan = true;
+		}
 		rcu_read_unlock();
 	}
 
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-05 15:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-05 14:34 [PATCHv3 1/4] mac80211: make mgmt_tx accept a NULL channel Antonio Quartulli
2013-06-05 14:34 ` [PATCHv3 2/4] brcm80211: make mgmt_tx in brcmfmac " Antonio Quartulli
2013-06-05 14:34 ` [PATCHv3 3/4] ath6kl: make mgmt_tx " Antonio Quartulli
2013-06-05 14:48   ` Kalle Valo
2013-06-05 14:51     ` Antonio Quartulli
2013-06-05 15:07       ` Kalle Valo
2013-06-05 14:34 ` [PATCHv3 4/4] nl80211: allow sending CMD_FRAME without specifying any frequency Antonio Quartulli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox