Skip to contentSkip to conversation

ieee802154: hwsim: using right kind of iteration

PATCH In review Alexander Aring 2 participants 2 messages Aug 12, 2018 – Aug 14, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 <[email protected]>
Fixes f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb")
---
 drivers/net/ieee802154/mac802154_hwsim.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ieee802154/mac802154_hwsim.c +3 -1
index 07a493dea11e..bf70ab892e69 100644
@@ -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;
Signature · 1 line
2.11.0
maintainer
#1 lore raw

From: Alexander Aring <[email protected]>
Date: Sun, 12 Aug 2018 16:24:56 -0400

Quoted 9 lines

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 <[email protected]>
Fixes f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb")

I'll apply this directly, thanks.