aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Beichler <benjamin.beichler@uni-rostock.de>2018-03-07 12:11:07 -0500
committerJohannes Berg <johannes.berg@intel.com>2018-03-21 05:57:33 -0400
commit8cfd36a0b53aeb4ec21d81eb79706697b84dfc3d (patch)
tree3a4a59d732bbf4e7d34fc90af03b2c66462f34bb
parent796e1112176ada7ebc084491458dfbfbe3a193b6 (diff)
mac80211_hwsim: fix use-after-free bug in hwsim_exit_net
When destroying a net namespace, all hwsim interfaces, which are not created in default namespace are deleted. But the async deletion of the interfaces could last longer than the actual destruction of the namespace, which results to an use after free bug. Therefore use synchronous deletion in this case. Fixes: 100cb9ff40e0 ("mac80211_hwsim: Allow managing radios from non-initial namespaces") Reported-by: syzbot+70ce058e01259de7bb1d@syzkaller.appspotmail.com Signed-off-by: Benjamin Beichler <benjamin.beichler@uni-rostock.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 930ddef91093..d9527c7b50d4 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -3528,8 +3528,12 @@ static void __net_exit hwsim_exit_net(struct net *net)
3528 list_del(&data->list); 3528 list_del(&data->list);
3529 rhashtable_remove_fast(&hwsim_radios_rht, &data->rht, 3529 rhashtable_remove_fast(&hwsim_radios_rht, &data->rht,
3530 hwsim_rht_params); 3530 hwsim_rht_params);
3531 INIT_WORK(&data->destroy_work, destroy_radio); 3531 hwsim_radios_generation++;
3532 queue_work(hwsim_wq, &data->destroy_work); 3532 spin_unlock_bh(&hwsim_radio_lock);
3533 mac80211_hwsim_del_radio(data,
3534 wiphy_name(data->hw->wiphy),
3535 NULL);
3536 spin_lock_bh(&hwsim_radio_lock);
3533 } 3537 }
3534 spin_unlock_bh(&hwsim_radio_lock); 3538 spin_unlock_bh(&hwsim_radio_lock);
3535 3539