diff options
author | Johannes Berg <johannes.berg@intel.com> | 2018-10-01 11:52:07 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2018-10-02 09:58:36 +0200 |
commit | b60ad3485106b5845113e7a2745abb7e64b15d6d (patch) | |
tree | 1edbb0fdc3876e3a34103056a20d39ad3460bead /net/wireless/core.h | |
parent | 71e5e886806ee3f8e0c44ed945eb2e4d6659c6e3 (diff) | |
download | linux-stable-b60ad3485106b5845113e7a2745abb7e64b15d6d.tar.gz linux-stable-b60ad3485106b5845113e7a2745abb7e64b15d6d.tar.bz2 linux-stable-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/core.h')
-rw-r--r-- | net/wireless/core.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/wireless/core.h b/net/wireless/core.h index 45fd4e21dbda..c61dbba8bf47 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h @@ -66,6 +66,7 @@ struct cfg80211_registered_device { /* protected by RTNL only */ int num_running_ifaces; int num_running_monitor_ifaces; + u64 cookie_counter; /* BSSes/scanning */ spinlock_t bss_lock; @@ -133,6 +134,16 @@ cfg80211_rdev_free_wowlan(struct cfg80211_registered_device *rdev) #endif } +static inline u64 cfg80211_assign_cookie(struct cfg80211_registered_device *rdev) +{ + u64 r = ++rdev->cookie_counter; + + if (WARN_ON(r == 0)) + r = ++rdev->cookie_counter; + + return r; +} + extern struct workqueue_struct *cfg80211_wq; extern struct list_head cfg80211_rdev_list; extern int cfg80211_rdev_list_generation; |