mac80211: fix a kernel panic when TXing after TXQ teardown
authorSara Sharon <sara.sharon@intel.com>
Sat, 15 Dec 2018 09:03:10 +0000 (11:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Jan 2019 08:51:01 +0000 (09:51 +0100)
commit4f784484bd96937dd86c41ec06cdac4f86c5300b
tree46cd851db96b23e574d1631108f7b75d1a99e13b
parent97fd4c7f6ddf1fefcce7e684f1eeb895b9fdf387
mac80211: fix a kernel panic when TXing after TXQ teardown

[ Upstream commit a50e5fb8db83c5b57392204c21ea6c5c4ccefde6 ]

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: 77cfaf52eca5 ("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>
net/mac80211/iface.c
net/mac80211/main.c