2
0

381-mac80211-fix-a-kernel-panic-when-TXing-after-TXQ-tea.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. From a50e5fb8db83c5b57392204c21ea6c5c4ccefde6 Mon Sep 17 00:00:00 2001
  2. From: Sara Sharon <[email protected]>
  3. Date: Sat, 15 Dec 2018 11:03:10 +0200
  4. Subject: [PATCH 1/3] mac80211: fix a kernel panic when TXing after TXQ
  5. teardown
  6. Recently TXQ teardown was moved earlier in ieee80211_unregister_hw(),
  7. to avoid a use-after-free of the netdev data. However, interfaces
  8. aren't fully removed at the point, and cfg80211_shutdown_all_interfaces
  9. can for example, TX a deauth frame. Move the TXQ teardown to the
  10. point between cfg80211_shutdown_all_interfaces and the free of
  11. netdev queues, so we can be sure they are torn down before netdev
  12. is freed, but after there is no ongoing TX.
  13. Fixes: 77cfaf52eca5 ("mac80211: Run TXQ teardown code before de-registering interfaces")
  14. Signed-off-by: Sara Sharon <[email protected]>
  15. Signed-off-by: Luca Coelho <[email protected]>
  16. Signed-off-by: Johannes Berg <[email protected]>
  17. ---
  18. net/mac80211/iface.c | 3 +++
  19. net/mac80211/main.c | 2 --
  20. 2 files changed, 3 insertions(+), 2 deletions(-)
  21. --- a/net/mac80211/iface.c
  22. +++ b/net/mac80211/iface.c
  23. @@ -7,6 +7,7 @@
  24. * Copyright 2008, Johannes Berg <[email protected]>
  25. * Copyright 2013-2014 Intel Mobile Communications GmbH
  26. * Copyright (c) 2016 Intel Deutschland GmbH
  27. + * Copyright (C) 2018 Intel Corporation
  28. *
  29. * This program is free software; you can redistribute it and/or modify
  30. * it under the terms of the GNU General Public License version 2 as
  31. @@ -2035,6 +2036,8 @@ void ieee80211_remove_interfaces(struct
  32. WARN(local->open_count, "%s: open count remains %d\n",
  33. wiphy_name(local->hw.wiphy), local->open_count);
  34. + ieee80211_txq_teardown_flows(local);
  35. +
  36. mutex_lock(&local->iflist_mtx);
  37. list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
  38. list_del(&sdata->list);
  39. --- a/net/mac80211/main.c
  40. +++ b/net/mac80211/main.c
  41. @@ -1200,7 +1200,6 @@ int ieee80211_register_hw(struct ieee802
  42. rtnl_unlock();
  43. ieee80211_led_exit(local);
  44. ieee80211_wep_free(local);
  45. - ieee80211_txq_teardown_flows(local);
  46. fail_flows:
  47. destroy_workqueue(local->workqueue);
  48. fail_workqueue:
  49. @@ -1226,7 +1225,6 @@ void ieee80211_unregister_hw(struct ieee
  50. #if IS_ENABLED(__disabled__CONFIG_IPV6)
  51. unregister_inet6addr_notifier(&local->ifa6_notifier);
  52. #endif
  53. - ieee80211_txq_teardown_flows(local);
  54. rtnl_lock();