|
@@ -2841,6 +2841,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 */
|
|
@@ -2850,10 +2856,15 @@ 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;
|
|
|
+ rcu_read_unlock();
|
|
|
+ goto out_unlock;
|
|
|
+ } else {
|
|
|
need_offchan = true;
|
|
|
+ }
|
|
|
rcu_read_unlock();
|
|
|
}
|
|
|
|