diff options
| author | Johannes Berg <johannes.berg@intel.com> | 2026-10-09 20:10:07 +0200 |
|---|---|---|
| committer | Johannes Berg <johannes.berg@intel.com> | 2026-10-13 13:58:13 +0200 |
| commit | fd6bcb455bf7d15165db1cbd325d53ad095fceee (patch) | |
| tree | 73873241ea83a4a27c0806e28c2732de6c304994 /net/wireless | |
| parent | 3938d944e8f8cce68981ad7fef785592435e15f9 (diff) | |
wifi: cfg80211: make cookie counter atomic
The cookie counter is currently protected by the
wiphy mutex, but in order to be able to transmit
management frames without holding that, we need
to assign cookies atomically.
Link: https://patch.msgid.link/20261009201417.ec1dbc786a60.I83ec404d833100a798181234c797c558400c7145@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
| -rw-r--r-- | net/wireless/core.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/wireless/core.h b/net/wireless/core.h index 0e05d4247bea..07d7a68a7cfc 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h @@ -83,7 +83,9 @@ struct cfg80211_registered_device { /* protected by RTNL only */ int num_running_ifaces; int num_running_monitor_ifaces; - u64 cookie_counter; + + /* atomic for unlocked users */ + atomic64_t cookie_counter; /* BSSes/scanning */ spinlock_t bss_lock; @@ -171,10 +173,10 @@ cfg80211_rdev_free_wowlan(struct cfg80211_registered_device *rdev) static inline u64 cfg80211_assign_cookie(struct cfg80211_registered_device *rdev) { - u64 r = ++rdev->cookie_counter; + u64 r = atomic64_inc_return(&rdev->cookie_counter); if (WARN_ON(r == 0)) - r = ++rdev->cookie_counter; + r = atomic64_inc_return(&rdev->cookie_counter); return r; } |
