Commit 00c3a6ed authored by Johannes Berg's avatar Johannes Berg

cfg80211: don't allow drivers to unset NL80211_FEATURE_SCAN_FLUSH

As the flag is entirely implemented in cfg80211, it should
have been a global feature flag (which I believe didn't
exist at the time). However, there's no reason to allow
drivers to unset the flag, so don't allow it and remove
the validation of NL80211_SCAN_FLAG_FLUSH.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 0f0094b3
...@@ -357,8 +357,6 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv) ...@@ -357,8 +357,6 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
rdev->wiphy.rts_threshold = (u32) -1; rdev->wiphy.rts_threshold = (u32) -1;
rdev->wiphy.coverage_class = 0; rdev->wiphy.coverage_class = 0;
rdev->wiphy.features = NL80211_FEATURE_SCAN_FLUSH;
return &rdev->wiphy; return &rdev->wiphy;
} }
EXPORT_SYMBOL(wiphy_new); EXPORT_SYMBOL(wiphy_new);
...@@ -566,6 +564,8 @@ int wiphy_register(struct wiphy *wiphy) ...@@ -566,6 +564,8 @@ int wiphy_register(struct wiphy *wiphy)
/* check and set up bitrates */ /* check and set up bitrates */
ieee80211_set_bitrate_flags(wiphy); ieee80211_set_bitrate_flags(wiphy);
rdev->wiphy.features |= NL80211_FEATURE_SCAN_FLUSH;
rtnl_lock(); rtnl_lock();
res = device_add(&rdev->wiphy.dev); res = device_add(&rdev->wiphy.dev);
if (res) { if (res) {
......
...@@ -5342,10 +5342,8 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) ...@@ -5342,10 +5342,8 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
if (info->attrs[NL80211_ATTR_SCAN_FLAGS]) { if (info->attrs[NL80211_ATTR_SCAN_FLAGS]) {
request->flags = nla_get_u32( request->flags = nla_get_u32(
info->attrs[NL80211_ATTR_SCAN_FLAGS]); info->attrs[NL80211_ATTR_SCAN_FLAGS]);
if (((request->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) && if ((request->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) &&
!(wiphy->features & NL80211_FEATURE_LOW_PRIORITY_SCAN)) || !(wiphy->features & NL80211_FEATURE_LOW_PRIORITY_SCAN)) {
((request->flags & NL80211_SCAN_FLAG_FLUSH) &&
!(wiphy->features & NL80211_FEATURE_SCAN_FLUSH))) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto out_free; goto out_free;
} }
...@@ -5585,10 +5583,8 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, ...@@ -5585,10 +5583,8 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
if (info->attrs[NL80211_ATTR_SCAN_FLAGS]) { if (info->attrs[NL80211_ATTR_SCAN_FLAGS]) {
request->flags = nla_get_u32( request->flags = nla_get_u32(
info->attrs[NL80211_ATTR_SCAN_FLAGS]); info->attrs[NL80211_ATTR_SCAN_FLAGS]);
if (((request->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) && if ((request->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) &&
!(wiphy->features & NL80211_FEATURE_LOW_PRIORITY_SCAN)) || !(wiphy->features & NL80211_FEATURE_LOW_PRIORITY_SCAN)) {
((request->flags & NL80211_SCAN_FLAG_FLUSH) &&
!(wiphy->features & NL80211_FEATURE_SCAN_FLUSH))) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto out_free; goto out_free;
} }
......
Markdown is supported
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