mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-02 08:11:32 -04:00
wifi: mac80211: use jiffies_delta_to_msecs() for sta_info inactive times
Inactive times of around 0xffffffff milliseconds have been observed on
an ath9k device on ARM. This is likely due to a memory ordering race in
the jiffies_to_msecs(jiffies - last_active()) calculation causing an
overflow when the observed jiffies is below ieee80211_sta_last_active().
Use jiffies_delta_to_msecs() instead to avoid this problem.
Fixes: 7bbdd2d987 ("mac80211: implement station stats retrieval")
Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Link: https://patch.msgid.link/20260303161701.31808-1-nicolas.cavallari@green-communications.fr
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
committed by
Johannes Berg
parent
708bbb4553
commit
ac6f24cc9c
@@ -2782,7 +2782,9 @@ static void sta_set_link_sinfo(struct sta_info *sta,
|
||||
}
|
||||
|
||||
link_sinfo->inactive_time =
|
||||
jiffies_to_msecs(jiffies - ieee80211_sta_last_active(sta, link_id));
|
||||
jiffies_delta_to_msecs(jiffies -
|
||||
ieee80211_sta_last_active(sta,
|
||||
link_id));
|
||||
|
||||
if (!(link_sinfo->filled & (BIT_ULL(NL80211_STA_INFO_TX_BYTES64) |
|
||||
BIT_ULL(NL80211_STA_INFO_TX_BYTES)))) {
|
||||
@@ -3015,7 +3017,8 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
|
||||
sinfo->connected_time = ktime_get_seconds() - sta->last_connected;
|
||||
sinfo->assoc_at = sta->assoc_at;
|
||||
sinfo->inactive_time =
|
||||
jiffies_to_msecs(jiffies - ieee80211_sta_last_active(sta, -1));
|
||||
jiffies_delta_to_msecs(jiffies -
|
||||
ieee80211_sta_last_active(sta, -1));
|
||||
|
||||
if (!(sinfo->filled & (BIT_ULL(NL80211_STA_INFO_TX_BYTES64) |
|
||||
BIT_ULL(NL80211_STA_INFO_TX_BYTES)))) {
|
||||
|
||||
Reference in New Issue
Block a user