mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
mac80211: fix a kernel panic when TXing after TXQ teardown
[ Upstream commita50e5fb8db] Recently TXQ teardown was moved earlier in ieee80211_unregister_hw(), to avoid a use-after-free of the netdev data. However, interfaces aren't fully removed at the point, and cfg80211_shutdown_all_interfaces can for example, TX a deauth frame. Move the TXQ teardown to the point between cfg80211_shutdown_all_interfaces and the free of netdev queues, so we can be sure they are torn down before netdev is freed, but after there is no ongoing TX. Fixes:77cfaf52ec("mac80211: Run TXQ teardown code before de-registering interfaces") Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
97fd4c7f6d
commit
4f784484bd
@@ -7,6 +7,7 @@
|
|||||||
* Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
|
* Copyright 2008, Johannes Berg <johannes@sipsolutions.net>
|
||||||
* Copyright 2013-2014 Intel Mobile Communications GmbH
|
* Copyright 2013-2014 Intel Mobile Communications GmbH
|
||||||
* Copyright (c) 2016 Intel Deutschland GmbH
|
* Copyright (c) 2016 Intel Deutschland GmbH
|
||||||
|
* Copyright (C) 2018 Intel Corporation
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -1951,6 +1952,8 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local)
|
|||||||
WARN(local->open_count, "%s: open count remains %d\n",
|
WARN(local->open_count, "%s: open count remains %d\n",
|
||||||
wiphy_name(local->hw.wiphy), local->open_count);
|
wiphy_name(local->hw.wiphy), local->open_count);
|
||||||
|
|
||||||
|
ieee80211_txq_teardown_flows(local);
|
||||||
|
|
||||||
mutex_lock(&local->iflist_mtx);
|
mutex_lock(&local->iflist_mtx);
|
||||||
list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
|
list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
|
||||||
list_del(&sdata->list);
|
list_del(&sdata->list);
|
||||||
|
|||||||
@@ -1198,7 +1198,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
|
|||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
ieee80211_led_exit(local);
|
ieee80211_led_exit(local);
|
||||||
ieee80211_wep_free(local);
|
ieee80211_wep_free(local);
|
||||||
ieee80211_txq_teardown_flows(local);
|
|
||||||
fail_flows:
|
fail_flows:
|
||||||
destroy_workqueue(local->workqueue);
|
destroy_workqueue(local->workqueue);
|
||||||
fail_workqueue:
|
fail_workqueue:
|
||||||
@@ -1224,7 +1223,6 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
|
|||||||
#if IS_ENABLED(CONFIG_IPV6)
|
#if IS_ENABLED(CONFIG_IPV6)
|
||||||
unregister_inet6addr_notifier(&local->ifa6_notifier);
|
unregister_inet6addr_notifier(&local->ifa6_notifier);
|
||||||
#endif
|
#endif
|
||||||
ieee80211_txq_teardown_flows(local);
|
|
||||||
|
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user