Message ID | 20191030213153.3196-2-anzaki@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Johannes Berg |
Headers | show |
Series | sta_info: fix insane values in iw sta dump "inactive time" | expand |
On Wed, 2019-10-30 at 15:31 -0600, Ahmed Zaki wrote: > In the first 5 mins after boot (initial jiffies), > ieee80211_sta_last_active() returns zero in case last_ack is zero. This > leads to insane values appearing in "inactive time". > > Fix by returning last_rx if last_ack == 0. Please read https://wireless.wiki.kernel.org/en/developers/Documentation/SubmittingPatches johannes
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index bd11fef2139f..428866ff7c0a 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2457,7 +2457,8 @@ unsigned long ieee80211_sta_last_active(struct sta_info *sta) { struct ieee80211_sta_rx_stats *stats = sta_get_last_rx_stats(sta); - if (time_after(stats->last_rx, sta->status_stats.last_ack)) + if (!sta->status_stats.last_ack || + time_after(stats->last_rx, sta->status_stats.last_ack)) return stats->last_rx; return sta->status_stats.last_ack; }