diff options
author | Thomas Pedersen <thomas@adapt-ip.com> | 2020-10-05 09:45:21 -0700 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2020-10-08 10:33:54 +0200 |
commit | 8b783d104e7f40684333d2ec155fac39219beb2f (patch) | |
tree | 6f93689c0dd1ef485d8d68126dabd9be0787e6be /net/mac80211/sta_info.c | |
parent | 9faebeb2d80065926dfbc09cb73b1bb7779a89cd (diff) | |
download | linux-8b783d104e7f40684333d2ec155fac39219beb2f.tar.bz2 |
mac80211: handle lack of sband->bitrates in rates
Even though a driver or mac80211 shouldn't produce a
legacy bitrate if sband->bitrates doesn't exist, don't
crash if that is the case either.
This fixes a kernel panic if station dump is run before
last_rate can be updated with a data frame when
sband->bitrates is missing (eg. in S1G bands).
Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
Link: https://lore.kernel.org/r/20201005164522.18069-1-thomas@adapt-ip.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/sta_info.c')
-rw-r--r-- | net/mac80211/sta_info.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index f2840d1d95cf..fb4f2b9b294f 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2122,6 +2122,10 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u32 rate, int rate_idx = STA_STATS_GET(LEGACY_IDX, rate); sband = local->hw.wiphy->bands[band]; + + if (WARN_ON_ONCE(!sband->bitrates)) + break; + brate = sband->bitrates[rate_idx].bitrate; if (rinfo->bw == RATE_INFO_BW_5) shift = 2; |