aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Aring <aring@mojatatu.com>2018-08-12 16:24:56 -0400
committerDavid S. Miller <davem@davemloft.net>2018-08-14 12:58:57 -0400
commit1c89a8e3d9a235454169e189ea6c463bfa8749ab (patch)
tree0f96a49cda7620855100c5ac60b9a0d383f248f1
parentac272a3e9c0838a2cbc76327e29788dc2af49abe (diff)
ieee802154: hwsim: using right kind of iteration
This patch fixes the error path to unsubscribe all other phy's from current phy. The actually code using a wrong kind of list iteration may copied from the case to unsubscribe the current phy from all other phy's. Cc: Stefan Schmidt <stefan@datenfreihafen.org> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb") Signed-off-by: Alexander Aring <aring@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ieee802154/mac802154_hwsim.c4
1 files changed, 3 insertions, 1 deletions
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)
735 return 0; 735 return 0;
736 736
737me_fail: 737me_fail:
738 list_for_each_entry(phy, &hwsim_phys, list) { 738 rcu_read_lock();
739 list_for_each_entry_rcu(e, &phy->edges, list) {
739 list_del_rcu(&e->list); 740 list_del_rcu(&e->list);
740 hwsim_free_edge(e); 741 hwsim_free_edge(e);
741 } 742 }
743 rcu_read_unlock();
742sub_fail: 744sub_fail:
743 hwsim_edge_unsubscribe_me(phy); 745 hwsim_edge_unsubscribe_me(phy);
744 return -ENOMEM; 746 return -ENOMEM;