提交 71fe96bf 编写于 作者: J Johannes Berg

nl80211: move "can set channel" check

Setting the wdev to NULL when the channel can't be
set for that interface type (to treat the channel
setting for the wiphy/monitor) currently works, but
is confusing in the code if netdev/wdev aren't both
set/unset in the same way. Move the check whether
the channel can be set to where it's needed so that
wdev and netdev are always both assigned or NULL.
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
上级 e8261171
...@@ -1516,10 +1516,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) ...@@ -1516,10 +1516,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
result = 0; result = 0;
mutex_lock(&rdev->mtx); mutex_lock(&rdev->mtx);
} else if (nl80211_can_set_dev_channel(netdev->ieee80211_ptr)) } else
wdev = netdev->ieee80211_ptr; wdev = netdev->ieee80211_ptr;
else
wdev = NULL;
/* /*
* end workaround code, by now the rdev is available * end workaround code, by now the rdev is available
...@@ -1579,7 +1577,9 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) ...@@ -1579,7 +1577,9 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
} }
if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) {
result = __nl80211_set_channel(rdev, wdev, info); result = __nl80211_set_channel(rdev,
nl80211_can_set_dev_channel(wdev) ? wdev : NULL,
info);
if (result) if (result)
goto bad_res; goto bad_res;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册