382-mac80211-Run-TXQ-teardown-code-before-de-registering.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <[email protected]>
  2. Date: Mon, 13 Aug 2018 14:16:25 +0200
  3. Subject: [PATCH] mac80211: Run TXQ teardown code before de-registering
  4. interfaces
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. The TXQ teardown code can reference the vif data structures that are
  9. stored in the netdev private memory area if there are still packets on
  10. the queue when it is being freed. Since the TXQ teardown code is run
  11. after the netdevs are freed, this can lead to a use-after-free. Fix this
  12. by moving the TXQ teardown code to earlier in ieee80211_unregister_hw().
  13. Reported-by: Ben Greear <[email protected]>
  14. Tested-by: Ben Greear <[email protected]>
  15. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
  16. Signed-off-by: Johannes Berg <[email protected]>
  17. ---
  18. --- a/net/mac80211/main.c
  19. +++ b/net/mac80211/main.c
  20. @@ -1172,6 +1172,7 @@ void ieee80211_unregister_hw(struct ieee
  21. #if IS_ENABLED(__disabled__CONFIG_IPV6)
  22. unregister_inet6addr_notifier(&local->ifa6_notifier);
  23. #endif
  24. + ieee80211_txq_teardown_flows(local);
  25. rtnl_lock();
  26. @@ -1200,7 +1201,6 @@ void ieee80211_unregister_hw(struct ieee
  27. skb_queue_purge(&local->skb_queue);
  28. skb_queue_purge(&local->skb_queue_unreliable);
  29. skb_queue_purge(&local->skb_queue_tdls_chsw);
  30. - ieee80211_txq_teardown_flows(local);
  31. destroy_workqueue(local->workqueue);
  32. wiphy_unregister(local->hw.wiphy);