summaryrefslogtreecommitdiffstats
path: root/drivers/net/ieee802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2015-05-17 21:45:04 +0200
committerMarcel Holtmann <marcel@holtmann.org>2015-05-19 11:44:46 +0200
commit6fa2cffe8cf937fc10be362a2dcac8a5965f618e (patch)
treedcd4bbfad53a414cc1a2ae8cb2bd8ef973b9441e /drivers/net/ieee802154
parentb82b99f16bc207291b14228441cfffbfd23d5f49 (diff)
downloadlinux-6fa2cffe8cf937fc10be362a2dcac8a5965f618e.tar.bz2
fakelb: move lock out of iteration
The list need to be protected while iteration which is need when other list iterates at the same time over this list. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/net/ieee802154')
-rw-r--r--drivers/net/ieee802154/fakelb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/ieee802154/fakelb.c b/drivers/net/ieee802154/fakelb.c
index c7e7d506224f..e1c0195c18aa 100644
--- a/drivers/net/ieee802154/fakelb.c
+++ b/drivers/net/ieee802154/fakelb.c
@@ -193,9 +193,7 @@ err_reg:
static void fakelb_del(struct fakelb_phy *phy)
{
- write_lock_bh(&fakelb_lock);
list_del(&phy->list);
- write_unlock_bh(&fakelb_lock);
ieee802154_unregister_hw(phy->hw);
ieee802154_free_hw(phy->hw);
@@ -217,8 +215,10 @@ static int fakelb_probe(struct platform_device *pdev)
return 0;
err_slave:
+ write_lock_bh(&fakelb_lock);
list_for_each_entry_safe(phy, tmp, &fakelb_phys, list)
fakelb_del(phy);
+ write_unlock_bh(&fakelb_lock);
return err;
}
@@ -226,9 +226,10 @@ static int fakelb_remove(struct platform_device *pdev)
{
struct fakelb_phy *phy, *temp;
+ write_lock_bh(&fakelb_lock);
list_for_each_entry_safe(phy, temp, &fakelb_phys, list)
fakelb_del(phy);
-
+ write_unlock_bh(&fakelb_lock);
return 0;
}