summaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2018-10-01 11:52:07 +0200
committerJohannes Berg <johannes.berg@intel.com>2018-10-02 09:58:36 +0200
commitb60ad3485106b5845113e7a2745abb7e64b15d6d (patch)
tree1edbb0fdc3876e3a34103056a20d39ad3460bead /net/wireless/nl80211.c
parent71e5e886806ee3f8e0c44ed945eb2e4d6659c6e3 (diff)
downloadlinux-b60ad3485106b5845113e7a2745abb7e64b15d6d.tar.gz
linux-b60ad3485106b5845113e7a2745abb7e64b15d6d.tar.bz2
linux-b60ad3485106b5845113e7a2745abb7e64b15d6d.zip
cfg80211: move cookie_counter out of wiphy
There's no reason for drivers to be able to access the cfg80211 internal cookie counter; move it out of the wiphy into the rdev structure. While at it, also make it never assign 0 as a cookie (we consider that invalid in some places), and warn if we manage to do that for some reason (wrapping is not likely to happen with a u64.) Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 8f962c79987a..60ce2eb57fbb 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7803,7 +7803,7 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
*/
if (want_multi && rdev->wiphy.max_sched_scan_reqs > 1) {
while (!sched_scan_req->reqid)
- sched_scan_req->reqid = rdev->wiphy.cookie_counter++;
+ sched_scan_req->reqid = cfg80211_assign_cookie(rdev);
}
err = rdev_sched_scan_start(rdev, dev, sched_scan_req);
@@ -11798,7 +11798,7 @@ static int nl80211_nan_add_func(struct sk_buff *skb,
if (!func)
return -ENOMEM;
- func->cookie = wdev->wiphy->cookie_counter++;
+ func->cookie = cfg80211_assign_cookie(rdev);
if (!tb[NL80211_NAN_FUNC_TYPE] ||
nla_get_u8(tb[NL80211_NAN_FUNC_TYPE]) > NL80211_NAN_FUNC_MAX_TYPE) {