wifi: mac80211: make rate u32 in sta_set_rate_info_rx()
authorShayne Chen <shayne.chen@mediatek.com>
Thu, 9 Feb 2023 11:06:59 +0000 (19:06 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 14 Feb 2023 11:23:12 +0000 (12:23 +0100)
The value of last_rate in ieee80211_sta_rx_stats is degraded from u32 to
u16 after being assigned to rate variable, which causes information loss
in STA_STATS_FIELD_TYPE and later bitfields.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://lore.kernel.org/r/20230209110659.25447-1-shayne.chen@mediatek.com
Fixes: 41cbb0f5a295 ("mac80211: add support for HE")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/sta_info.c

index 27c737f..bd532d3 100644 (file)
@@ -2418,7 +2418,7 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u32 rate,
 
 static int sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo)
 {
-       u16 rate = READ_ONCE(sta_get_last_rx_stats(sta)->last_rate);
+       u32 rate = READ_ONCE(sta_get_last_rx_stats(sta)->last_rate);
 
        if (rate == STA_STATS_RATE_INVALID)
                return -EINVAL;