Commit f7aeb6fb authored by Antonio Quartulli's avatar Antonio Quartulli Committed by Johannes Berg
Browse files

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: default avatarAntonio Quartulli <>
[fix RCU locking]
Signed-off-by: default avatarJohannes Berg <>
parent 3d124ea2
......@@ -2841,6 +2841,12 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
/* configurations requiring offchan cannot work if no channel has been
* specified
if (need_offchan && !chan)
return -EINVAL;
/* 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,
chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
if (chanctx_conf)
need_offchan = chan != chanctx_conf->def.chan;
if (chanctx_conf) {
need_offchan = chan && (chan != chanctx_conf->def.chan);
} else if (!chan) {
ret = -EINVAL;
goto out_unlock;
} else {
need_offchan = true;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment