linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] b43legacy: Fix a sleep-in-atomic bug in b43legacy_attr_interfmode_store
@ 2017-05-31 10:29 Jia-Ju Bai
  2017-05-31 15:17 ` Michael Büsch
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jia-Ju Bai @ 2017-05-31 10:29 UTC (permalink / raw)
  To: Larry.Finger, kvalo
  Cc: linux-wireless, b43-dev, netdev, linux-kernel, Jia-Ju Bai

The driver may sleep under a spin lock, and the function call path is:
b43legacy_attr_interfmode_store (acquire the lock by spin_lock_irqsave)
  b43legacy_radio_set_interference_mitigation
    b43legacy_radio_interference_mitigation_disable
      b43legacy_calc_nrssi_slope
        b43legacy_synth_pu_workaround
          might_sleep and msleep --> may sleep

Fixing it may be complex, and a possible way is to remove 
spin_lock_irqsave and spin_lock_irqrestore in 
b43legacy_attr_interfmode_store, and the code has been protected by
mutex_lock and mutex_unlock.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/net/wireless/broadcom/b43legacy/sysfs.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/wireless/broadcom/b43legacy/sysfs.c b/drivers/net/wireless/broadcom/b43legacy/sysfs.c
index 2a1da15..9ede143 100644
--- a/drivers/net/wireless/broadcom/b43legacy/sysfs.c
+++ b/drivers/net/wireless/broadcom/b43legacy/sysfs.c
@@ -137,14 +137,12 @@ static ssize_t b43legacy_attr_interfmode_store(struct device *dev,
 	}
 
 	mutex_lock(&wldev->wl->mutex);
-	spin_lock_irqsave(&wldev->wl->irq_lock, flags);
 
 	err = b43legacy_radio_set_interference_mitigation(wldev, mode);
 	if (err)
 		b43legacyerr(wldev->wl, "Interference Mitigation not "
 		       "supported by device\n");
 	mmiowb();
-	spin_unlock_irqrestore(&wldev->wl->irq_lock, flags);
 	mutex_unlock(&wldev->wl->mutex);
 
 	return err ? err : count;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-07-30 11:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-31 10:29 [PATCH] b43legacy: Fix a sleep-in-atomic bug in b43legacy_attr_interfmode_store Jia-Ju Bai
2017-05-31 15:17 ` Michael Büsch
2017-05-31 17:33 ` Larry Finger
2017-06-01  1:05   ` Jia-Ju Bai
2017-06-01  4:15     ` Kalle Valo
2017-06-01 16:11     ` Jonathan Corbet
2017-06-01 17:43       ` Larry Finger
2017-06-02  1:18       ` Jia-Ju Bai
2017-07-30 10:24         ` Michael Büsch
2017-06-01 23:24 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).