Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1654107

[PATCH] b43legacy: Fix a sleep-in-atomic bug in b43legacy_attr_interfmode_store

From Jia-Ju Bai <baijiaju1990@163.com>
Newsgroups linux.kernel
Subject [PATCH] b43legacy: Fix a sleep-in-atomic bug in b43legacy_attr_interfmode_store
Date 2017-05-31 12:30 +0200
Message-ID <tN934-3sV-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] b43legacy: Fix a sleep-in-atomic bug in b43legacy_attr_interfmode_store Jia-Ju Bai <baijiaju1990@163.com> - 2017-05-31 12:30 +0200
  Re: [PATCH] b43legacy: Fix a sleep-in-atomic bug in  b43legacy_attr_interfmode_store Michael Büsch <m@bues.ch> - 2017-05-31 17:20 +0200
  Re: [PATCH] b43legacy: Fix a sleep-in-atomic bug in  b43legacy_attr_interfmode_store Larry Finger <Larry.Finger@lwfinger.net> - 2017-05-31 19:40 +0200
    Re: [PATCH] b43legacy: Fix a sleep-in-atomic bug in b43legacy_attr_interfmode_store Jia-Ju Bai <baijiaju1990@163.com> - 2017-06-01 03:10 +0200
      Re: [PATCH] b43legacy: Fix a sleep-in-atomic bug in b43legacy_attr_interfmode_store Kalle Valo <kvalo@codeaurora.org> - 2017-06-01 06:20 +0200
      Re: [PATCH] b43legacy: Fix a sleep-in-atomic bug in  b43legacy_attr_interfmode_store Jonathan Corbet <corbet@lwn.net> - 2017-06-01 18:20 +0200
        Re: [PATCH] b43legacy: Fix a sleep-in-atomic bug in  b43legacy_attr_interfmode_store Larry Finger <Larry.Finger@lwfinger.net> - 2017-06-01 19:50 +0200
        Re: [PATCH] b43legacy: Fix a sleep-in-atomic bug in b43legacy_attr_interfmode_store Jia-Ju Bai <baijiaju1990@163.com> - 2017-06-02 03:20 +0200

csiph-web