2
0

374-ath9k-Protect-queue-draining-by-rcu_read_lock.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <[email protected]>
  2. Date: Fri, 2 Feb 2018 11:36:45 +0100
  3. Subject: [PATCH] ath9k: Protect queue draining by rcu_read_lock()
  4. MIME-Version: 1.0
  5. Content-Type: text/plain; charset=UTF-8
  6. Content-Transfer-Encoding: 8bit
  7. When ath9k was switched over to use the mac80211 intermediate queues,
  8. node cleanup now drains the mac80211 queues. However, this call path is
  9. not protected by rcu_read_lock() as it was previously entirely internal
  10. to the driver which uses its own locking.
  11. This leads to a possible rcu_dereference() without holding
  12. rcu_read_lock(); but only if a station is cleaned up while having
  13. packets queued on the TXQ. Fix this by adding the rcu_read_lock() to the
  14. caller in ath9k.
  15. Fixes: 50f08edf9809 ("ath9k: Switch to using mac80211 intermediate software queues.")
  16. Cc: [email protected]
  17. Reported-by: Ben Greear <[email protected]>
  18. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
  19. ---
  20. --- a/drivers/net/wireless/ath/ath9k/xmit.c
  21. +++ b/drivers/net/wireless/ath/ath9k/xmit.c
  22. @@ -2930,6 +2930,8 @@ void ath_tx_node_cleanup(struct ath_soft
  23. struct ath_txq *txq;
  24. int tidno;
  25. + rcu_read_lock();
  26. +
  27. for (tidno = 0; tidno < IEEE80211_NUM_TIDS; tidno++) {
  28. tid = ath_node_to_tid(an, tidno);
  29. txq = tid->txq;
  30. @@ -2947,6 +2949,8 @@ void ath_tx_node_cleanup(struct ath_soft
  31. if (!an->sta)
  32. break; /* just one multicast ath_atx_tid */
  33. }
  34. +
  35. + rcu_read_unlock();
  36. }
  37. #ifdef CPTCFG_ATH9K_TX99