340-mac80211-fix-parsing-of-40Mhz-in-injected-radiotap-h.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From: Sven Eckelmann <sven@narfation.org>
  2. Date: Wed, 24 Feb 2016 16:25:49 +0100
  3. Subject: [PATCH] mac80211: fix parsing of 40Mhz in injected radiotap
  4. header
  5. The MCS bandwidth part of the radiotap header is 2 bits wide. The full 2
  6. bit have to compared against IEEE80211_RADIOTAP_MCS_BW_40 and not only if
  7. the first bit is set. Otherwise IEEE80211_RADIOTAP_MCS_BW_40 can be
  8. confused with IEEE80211_RADIOTAP_MCS_BW_20U.
  9. Fixes: 5ec3aed9ba4c ("mac80211: Parse legacy and HT rate in injected frames")
  10. Signed-off-by: Sven Eckelmann <sven@narfation.org>
  11. ---
  12. --- a/net/mac80211/tx.c
  13. +++ b/net/mac80211/tx.c
  14. @@ -1689,7 +1689,7 @@ static bool ieee80211_parse_tx_radiotap(
  15. bool rate_found = false;
  16. u8 rate_retries = 0;
  17. u16 rate_flags = 0;
  18. - u8 mcs_known, mcs_flags;
  19. + u8 mcs_known, mcs_flags, mcs_bw;
  20. int i;
  21. info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
  22. @@ -1765,8 +1765,9 @@ static bool ieee80211_parse_tx_radiotap(
  23. mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
  24. rate_flags |= IEEE80211_TX_RC_SHORT_GI;
  25. + mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
  26. if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
  27. - mcs_flags & IEEE80211_RADIOTAP_MCS_BW_40)
  28. + mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
  29. rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
  30. break;