Skip to content

Commit

Permalink
mac80211: make mgmt_tx accept a NULL channel
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Antonio Quartulli authored and Johannes Berg committed Jun 11, 2013
1 parent 3d124ea commit f7aeb6f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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();
}

Expand Down

0 comments on commit f7aeb6f

Please sign in to comment.