developer | 8935fc1 | 2024-01-11 14:08:37 +0800 | [diff] [blame] | 1 | From: David Bauer <mail@david-bauer.net> |
| 2 | Date: Thu, 30 Nov 2023 07:32:52 +0100 |
| 3 | Subject: [PATCH] mac80211: avoid crashing on invalid band info |
| 4 | |
| 5 | Frequent crashes have been observed on MT7916 based platforms. While the |
| 6 | root of these crashes are currently unknown, they happen when decoding |
| 7 | rate information of connected STAs in AP mode. The rate-information is |
| 8 | associated with a band which is not available on the PHY. |
| 9 | |
| 10 | Check for this condition in order to avoid crashing the whole system. |
| 11 | This patch should be removed once the roout cause has been found and |
| 12 | fixed. |
| 13 | |
| 14 | Link: https://github.com/freifunk-gluon/gluon/issues/2980 |
| 15 | |
| 16 | Signed-off-by: David Bauer <mail@david-bauer.net> |
| 17 | --- |
| 18 | |
| 19 | --- a/net/mac80211/sta_info.c |
| 20 | +++ b/net/mac80211/sta_info.c |
developer | 43a264f | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 21 | @@ -2445,6 +2445,13 @@ static void sta_stats_decode_rate(struct |
developer | 8935fc1 | 2024-01-11 14:08:37 +0800 | [diff] [blame] | 22 | |
| 23 | sband = local->hw.wiphy->bands[band]; |
| 24 | |
| 25 | + if (!sband) { |
| 26 | + wiphy_warn(local->hw.wiphy, |
| 27 | + "Invalid band %d\n", |
| 28 | + band); |
| 29 | + break; |
| 30 | + } |
| 31 | + |
| 32 | if (WARN_ON_ONCE(!sband->bitrates)) |
| 33 | break; |
| 34 | |