Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Thomas Pedersen and committed by
Johannes Berg
8b783d10 9faebeb2

+6 -1
+2 -1
net/mac80211/cfg.c
··· 709 709 u16 brate; 710 710 711 711 sband = ieee80211_get_sband(sta->sdata); 712 - if (sband) { 712 + WARN_ON_ONCE(sband && !sband->bitrates); 713 + if (sband && sband->bitrates) { 713 714 brate = sband->bitrates[rate->idx].bitrate; 714 715 rinfo->legacy = DIV_ROUND_UP(brate, 1 << shift); 715 716 }
+4
net/mac80211/sta_info.c
··· 2122 2122 int rate_idx = STA_STATS_GET(LEGACY_IDX, rate); 2123 2123 2124 2124 sband = local->hw.wiphy->bands[band]; 2125 + 2126 + if (WARN_ON_ONCE(!sband->bitrates)) 2127 + break; 2128 + 2125 2129 brate = sband->bitrates[rate_idx].bitrate; 2126 2130 if (rinfo->bw == RATE_INFO_BW_5) 2127 2131 shift = 2;