diff options
| author | Alexander Aring <aar@pengutronix.de> | 2016-09-01 05:24:57 -0400 |
|---|---|---|
| committer | Marcel Holtmann <marcel@holtmann.org> | 2016-09-19 14:19:34 -0400 |
| commit | bdca1fd9a6df745857e23c6056494b7fe062b4e6 (patch) | |
| tree | 208199f3d93f8033688dd731405aa2328c467497 /drivers/net/ieee802154 | |
| parent | 8a0c9f49090fe8ae122fd1bbf7260c8492289386 (diff) | |
fakelb: fix schedule while atomic
This patch changes the spinlock to mutex for the available fakelb phy
list. When holding the spinlock the ieee802154_unregister_hw is called
which holding the rtnl_mutex, in that case we get a "BUG: sleeping function
called from invalid context" error. We simple change the spinlock to
mutex which allows to hold the rtnl lock there.
Signed-off-by: Alexander Aring <aar@pengutronix.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/net/ieee802154')
| -rw-r--r-- | drivers/net/ieee802154/fakelb.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/ieee802154/fakelb.c b/drivers/net/ieee802154/fakelb.c index 0becf0ac3926..ec387efb61d0 100644 --- a/drivers/net/ieee802154/fakelb.c +++ b/drivers/net/ieee802154/fakelb.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | static int numlbs = 2; | 30 | static int numlbs = 2; |
| 31 | 31 | ||
| 32 | static LIST_HEAD(fakelb_phys); | 32 | static LIST_HEAD(fakelb_phys); |
| 33 | static DEFINE_SPINLOCK(fakelb_phys_lock); | 33 | static DEFINE_MUTEX(fakelb_phys_lock); |
| 34 | 34 | ||
| 35 | static LIST_HEAD(fakelb_ifup_phys); | 35 | static LIST_HEAD(fakelb_ifup_phys); |
| 36 | static DEFINE_RWLOCK(fakelb_ifup_phys_lock); | 36 | static DEFINE_RWLOCK(fakelb_ifup_phys_lock); |
| @@ -188,9 +188,9 @@ static int fakelb_add_one(struct device *dev) | |||
| 188 | if (err) | 188 | if (err) |
| 189 | goto err_reg; | 189 | goto err_reg; |
| 190 | 190 | ||
| 191 | spin_lock(&fakelb_phys_lock); | 191 | mutex_lock(&fakelb_phys_lock); |
| 192 | list_add_tail(&phy->list, &fakelb_phys); | 192 | list_add_tail(&phy->list, &fakelb_phys); |
| 193 | spin_unlock(&fakelb_phys_lock); | 193 | mutex_unlock(&fakelb_phys_lock); |
| 194 | 194 | ||
| 195 | return 0; | 195 | return 0; |
| 196 | 196 | ||
| @@ -222,10 +222,10 @@ static int fakelb_probe(struct platform_device *pdev) | |||
| 222 | return 0; | 222 | return 0; |
| 223 | 223 | ||
| 224 | err_slave: | 224 | err_slave: |
| 225 | spin_lock(&fakelb_phys_lock); | 225 | mutex_lock(&fakelb_phys_lock); |
| 226 | list_for_each_entry_safe(phy, tmp, &fakelb_phys, list) | 226 | list_for_each_entry_safe(phy, tmp, &fakelb_phys, list) |
| 227 | fakelb_del(phy); | 227 | fakelb_del(phy); |
| 228 | spin_unlock(&fakelb_phys_lock); | 228 | mutex_unlock(&fakelb_phys_lock); |
| 229 | return err; | 229 | return err; |
| 230 | } | 230 | } |
| 231 | 231 | ||
| @@ -233,10 +233,10 @@ static int fakelb_remove(struct platform_device *pdev) | |||
| 233 | { | 233 | { |
| 234 | struct fakelb_phy *phy, *tmp; | 234 | struct fakelb_phy *phy, *tmp; |
| 235 | 235 | ||
| 236 | spin_lock(&fakelb_phys_lock); | 236 | mutex_lock(&fakelb_phys_lock); |
| 237 | list_for_each_entry_safe(phy, tmp, &fakelb_phys, list) | 237 | list_for_each_entry_safe(phy, tmp, &fakelb_phys, list) |
| 238 | fakelb_del(phy); | 238 | fakelb_del(phy); |
| 239 | spin_unlock(&fakelb_phys_lock); | 239 | mutex_unlock(&fakelb_phys_lock); |
| 240 | return 0; | 240 | return 0; |
| 241 | } | 241 | } |
| 242 | 242 | ||
