blob: 35fa961d21a7526b7ecac5cd21eda02ac3c8cf45 [file] [log] [blame]
developer8935fc12024-01-11 14:08:37 +08001From: David Bauer <mail@david-bauer.net>
2Date: Thu, 30 Nov 2023 07:32:52 +0100
3Subject: [PATCH] mac80211: avoid crashing on invalid band info
4
5Frequent crashes have been observed on MT7916 based platforms. While the
6root of these crashes are currently unknown, they happen when decoding
7rate information of connected STAs in AP mode. The rate-information is
8associated with a band which is not available on the PHY.
9
10Check for this condition in order to avoid crashing the whole system.
11This patch should be removed once the roout cause has been found and
12fixed.
13
14Link: https://github.com/freifunk-gluon/gluon/issues/2980
15
16Signed-off-by: David Bauer <mail@david-bauer.net>
17---
18
19--- a/net/mac80211/sta_info.c
20+++ b/net/mac80211/sta_info.c
developer43a264f2024-03-26 14:09:54 +080021@@ -2445,6 +2445,13 @@ static void sta_stats_decode_rate(struct
developer8935fc12024-01-11 14:08:37 +080022
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