301-v4.15-mac80211-properly-free-requested-but-not-started-TX-.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From: Johannes Berg <[email protected]>
  2. Date: Mon, 20 Nov 2017 17:01:44 +0100
  3. Subject: [PATCH] mac80211: properly free requested-but-not-started TX agg
  4. sessions
  5. When deleting a station or otherwise tearing down all aggregation
  6. sessions, make sure to delete requested but not yet started ones,
  7. to avoid the following scenario:
  8. * session is requested, added to tid_start_tx[]
  9. * ieee80211_ba_session_work() runs, gets past BLOCK_BA check
  10. * ieee80211_sta_tear_down_BA_sessions() runs, locks &sta->ampdu_mlme.mtx,
  11. e.g. while deleting the station - deleting all active sessions
  12. * ieee80211_ba_session_work() continues since tear down flushes it, and
  13. calls ieee80211_tx_ba_session_handle_start() for the new session, arms
  14. the timer for it
  15. * station deletion continues to __cleanup_single_sta() and frees the
  16. session struct, while the timer is armed
  17. Reported-by: Fengguang Wu <[email protected]>
  18. Signed-off-by: Johannes Berg <[email protected]>
  19. ---
  20. --- a/net/mac80211/agg-tx.c
  21. +++ b/net/mac80211/agg-tx.c
  22. @@ -330,6 +330,11 @@ int ___ieee80211_stop_tx_ba_session(stru
  23. spin_lock_bh(&sta->lock);
  24. + /* free struct pending for start, if present */
  25. + tid_tx = sta->ampdu_mlme.tid_start_tx[tid];
  26. + kfree(tid_tx);
  27. + sta->ampdu_mlme.tid_start_tx[tid] = NULL;
  28. +
  29. tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
  30. if (!tid_tx) {
  31. spin_unlock_bh(&sta->lock);