提交 e603d9d8 编写于 作者: J Johannes Berg 提交者: John W. Linville

mac80211_hwsim: fix use after free

Once the "data" pointer is freed, we can't be iterating
to the next item in the list any more so we need to use
list_for_each_entry_safe with a temporary variable.
Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 5d416351
...@@ -709,7 +709,7 @@ static const struct ieee80211_ops mac80211_hwsim_ops = ...@@ -709,7 +709,7 @@ static const struct ieee80211_ops mac80211_hwsim_ops =
static void mac80211_hwsim_free(void) static void mac80211_hwsim_free(void)
{ {
struct list_head tmplist, *i, *tmp; struct list_head tmplist, *i, *tmp;
struct mac80211_hwsim_data *data; struct mac80211_hwsim_data *data, *tmpdata;
INIT_LIST_HEAD(&tmplist); INIT_LIST_HEAD(&tmplist);
...@@ -718,7 +718,7 @@ static void mac80211_hwsim_free(void) ...@@ -718,7 +718,7 @@ static void mac80211_hwsim_free(void)
list_move(i, &tmplist); list_move(i, &tmplist);
spin_unlock_bh(&hwsim_radio_lock); spin_unlock_bh(&hwsim_radio_lock);
list_for_each_entry(data, &tmplist, list) { list_for_each_entry_safe(data, tmpdata, &tmplist, list) {
debugfs_remove(data->debugfs_group); debugfs_remove(data->debugfs_group);
debugfs_remove(data->debugfs_ps); debugfs_remove(data->debugfs_ps);
debugfs_remove(data->debugfs); debugfs_remove(data->debugfs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册