780-avoid-crashing-missing-band.patch 1012 B

12345678910111213141516171819202122232425262728293031323334
  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. Frequent crashes have been observed on MT7916 based platforms. While the
  5. root of these crashes are currently unknown, they happen when decoding
  6. rate information of connected STAs in AP mode. The rate-information is
  7. associated with a band which is not available on the PHY.
  8. Check for this condition in order to avoid crashing the whole system.
  9. This patch should be removed once the roout cause has been found and
  10. fixed.
  11. Link: https://github.com/freifunk-gluon/gluon/issues/2980
  12. Signed-off-by: David Bauer <mail@david-bauer.net>
  13. ---
  14. --- a/net/mac80211/sta_info.c
  15. +++ b/net/mac80211/sta_info.c
  16. @@ -2364,6 +2364,13 @@ static void sta_stats_decode_rate(struct
  17. sband = local->hw.wiphy->bands[band];
  18. + if (!sband) {
  19. + wiphy_warn(local->hw.wiphy,
  20. + "Invalid band %d\n",
  21. + band);
  22. + break;
  23. + }
  24. +
  25. if (WARN_ON_ONCE(!sband->bitrates))
  26. break;