304-mac80211-fix-PS-Poll-handling.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From: Emmanuel Grumbach <[email protected]>
  2. Date: Sun, 20 Dec 2015 13:50:00 +0200
  3. Subject: [PATCH] mac80211: fix PS-Poll handling
  4. My commit below broken PS-Poll handling. In case the driver
  5. has no frames buffered, driver_release_tids will be 0, but
  6. calling find_highest_prio_tid() with 0 as a parameter is
  7. not a good idea:
  8. fls(0) - 1 = -1.
  9. This bug caused mac80211 to think that frames were buffered
  10. in the driver which in turn was confused because mac80211
  11. was asking to release frames that were not reported to
  12. exist.
  13. On iwlwifi, this led to the WARNING below:
  14. WARNING: CPU: 0 PID: 11230 at drivers/net/wireless/intel/iwlwifi/mvm/sta.c:1733 iwl_mvm_sta_modify_sleep_tx_count+0x2af/0x320 [iwlmvm]()
  15. ffffffffc0627c60 ffff8800069b7648 ffffffff81888913 0000000000000000
  16. 0000000000000000 ffff8800069b7688 ffffffff81089d6a ffff8800069b7678
  17. 0000000000000001 ffff88003b35abf0 ffff88000698b128 ffff8800069b76d4
  18. Call Trace:
  19. [<ffffffff81888913>] dump_stack+0x4c/0x65
  20. [<ffffffff81089d6a>] warn_slowpath_common+0x8a/0xc0
  21. [<ffffffff81089e5a>] warn_slowpath_null+0x1a/0x20
  22. [<ffffffffc05f36bf>] iwl_mvm_sta_modify_sleep_tx_count+0x2af/0x320 [iwlmvm]
  23. [<ffffffffc05dae41>] iwl_mvm_mac_release_buffered_frames+0x31/0x40 [iwlmvm]
  24. [<ffffffffc045d8b6>] ieee80211_sta_ps_deliver_response+0x6e6/0xd80 [mac80211]
  25. [<ffffffffc0461296>] ieee80211_sta_ps_deliver_poll_response+0x26/0x30 [mac80211]
  26. [<ffffffffc048f743>] ieee80211_rx_handlers+0xa83/0x2900 [mac80211]
  27. [<ffffffffc04917ad>] ieee80211_prepare_and_rx_handle+0x1ed/0xa70 [mac80211]
  28. [<ffffffffc045e3d5>] ? sta_info_get_bss+0x5/0x4a0 [mac80211]
  29. [<ffffffffc04925b6>] ieee80211_rx_napi+0x586/0xcd0 [mac80211]
  30. [<ffffffffc05eaa3e>] iwl_mvm_rx_rx_mpdu+0x59e/0xc60 [iwlmvm]
  31. Fixes: 0ead2510f8ce ("mac80211: allow the driver to send EOSP when needed")
  32. Signed-off-by: Emmanuel Grumbach <[email protected]>
  33. ---
  34. --- a/net/mac80211/sta_info.c
  35. +++ b/net/mac80211/sta_info.c
  36. @@ -1453,7 +1453,7 @@ ieee80211_sta_ps_deliver_response(struct
  37. more_data = ieee80211_sta_ps_more_data(sta, ignored_acs, reason, driver_release_tids);
  38. - if (reason == IEEE80211_FRAME_RELEASE_PSPOLL)
  39. + if (driver_release_tids && reason == IEEE80211_FRAME_RELEASE_PSPOLL)
  40. driver_release_tids =
  41. BIT(find_highest_prio_tid(driver_release_tids));