diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 4fdb306e..bb42bcd 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -2831,7 +2831,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, mutex_lock(&local->mtx); - /* Check if the operating channel is the requested channel */ + /* Check if the operating channel is the requested channel (if any) */ if (!need_offchan) { struct ieee80211_chanctx_conf *chanctx_conf; @@ -2839,12 +2839,17 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); if (chanctx_conf) - need_offchan = chan != chanctx_conf->def.chan; + need_offchan = chan && chan != chanctx_conf->def.chan; else need_offchan = true; rcu_read_unlock(); } + if (need_offchan && !chan) { + ret = -EINVAL; + goto out_unlock; + } + if (need_offchan && !offchan) { ret = -EBUSY; goto out_unlock;