]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ieee802154: hwsim: using right kind of iteration
authorAlexander Aring <aring@mojatatu.com>
Sun, 12 Aug 2018 20:24:56 +0000 (16:24 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Aug 2018 16:58:57 +0000 (09:58 -0700)
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>
drivers/net/ieee802154/mac802154_hwsim.c

index 07a493dea11ed9fc66bfe08cea16124110fa116b..bf70ab892e697865eeffd69a01674da634127885 100644 (file)
@@ -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;