diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c index 07a493dea11e..bf70ab892e69 100644 --- a/drivers/net/ieee802154/mac802154_hwsim.c +++ b/drivers/net/ieee802154/mac802154_hwsim.c @@ -735,10 +735,12 @@ static int hwsim_subscribe_all_others(struct hwsim_phy *phy) return 0; me_fail: - list_for_each_entry(phy, &hwsim_phys, list) { + rcu_read_lock(); + list_for_each_entry_rcu(e, &phy->edges, list) { list_del_rcu(&e->list); hwsim_free_edge(e); } + rcu_read_unlock(); sub_fail: hwsim_edge_unsubscribe_me(phy); return -ENOMEM;