Commit 4dbfb7dd authored by Larry Finger's avatar Larry Finger Committed by Greg Kroah-Hartman

b43: Fix lockdep splat

commit 09164043 upstream.

In https://bugzilla.kernel.org/show_bug.cgi?id=67561, a locking dependency is reported
when b43 is used with hostapd, and rfkill is used to kill the radio output.

The lockdep splat (in part) is as follows:

======================================================
[ INFO: possible circular locking dependency detected ]
3.12.0 #1 Not tainted
-------------------------------------------------------
rfkill/10040 is trying to acquire lock:
 (rtnl_mutex){+.+.+.}, at: [<ffffffff8146f282>] rtnl_lock+0x12/0x20

but task is already holding lock:
 (rfkill_global_mutex){+.+.+.}, at: [<ffffffffa04832ca>] rfkill_fop_write+0x6a/0x170 [rfkill]

--snip--

Chain exists of:
  rtnl_mutex --> misc_mtx --> rfkill_global_mutex

The fix is to move the initialization of the hardware random number generator
outside the code range covered by the rtnl_mutex.
Reported-by: default avataryury <urykhy@gmail.com>
Tested-by: default avataryury <urykhy@gmail.com>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2ef4b350
...@@ -2413,6 +2413,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) ...@@ -2413,6 +2413,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl); static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl);
static void b43_one_core_detach(struct b43_bus_dev *dev); static void b43_one_core_detach(struct b43_bus_dev *dev);
static int b43_rng_init(struct b43_wl *wl);
static void b43_request_firmware(struct work_struct *work) static void b43_request_firmware(struct work_struct *work)
{ {
...@@ -2459,6 +2460,10 @@ static void b43_request_firmware(struct work_struct *work) ...@@ -2459,6 +2460,10 @@ static void b43_request_firmware(struct work_struct *work)
if (err) if (err)
goto err_one_core_detach; goto err_one_core_detach;
b43_leds_register(wl->current_dev); b43_leds_register(wl->current_dev);
/* Register HW RNG driver */
b43_rng_init(wl);
goto out; goto out;
err_one_core_detach: err_one_core_detach:
...@@ -4583,9 +4588,6 @@ static void b43_wireless_core_exit(struct b43_wldev *dev) ...@@ -4583,9 +4588,6 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
if (!dev || b43_status(dev) != B43_STAT_INITIALIZED) if (!dev || b43_status(dev) != B43_STAT_INITIALIZED)
return; return;
/* Unregister HW RNG driver */
b43_rng_exit(dev->wl);
b43_set_status(dev, B43_STAT_UNINIT); b43_set_status(dev, B43_STAT_UNINIT);
/* Stop the microcode PSM. */ /* Stop the microcode PSM. */
...@@ -4728,9 +4730,6 @@ static int b43_wireless_core_init(struct b43_wldev *dev) ...@@ -4728,9 +4730,6 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
b43_set_status(dev, B43_STAT_INITIALIZED); b43_set_status(dev, B43_STAT_INITIALIZED);
/* Register HW RNG driver */
b43_rng_init(dev->wl);
out: out:
return err; return err;
...@@ -5388,6 +5387,9 @@ static void b43_bcma_remove(struct bcma_device *core) ...@@ -5388,6 +5387,9 @@ static void b43_bcma_remove(struct bcma_device *core)
b43_one_core_detach(wldev->dev); b43_one_core_detach(wldev->dev);
/* Unregister HW RNG driver */
b43_rng_exit(wl);
b43_leds_unregister(wl); b43_leds_unregister(wl);
ieee80211_free_hw(wl->hw); ieee80211_free_hw(wl->hw);
...@@ -5468,6 +5470,9 @@ static void b43_ssb_remove(struct ssb_device *sdev) ...@@ -5468,6 +5470,9 @@ static void b43_ssb_remove(struct ssb_device *sdev)
b43_one_core_detach(dev); b43_one_core_detach(dev);
/* Unregister HW RNG driver */
b43_rng_exit(wl);
if (list_empty(&wl->devlist)) { if (list_empty(&wl->devlist)) {
b43_leds_unregister(wl); b43_leds_unregister(wl);
/* Last core on the chip unregistered. /* Last core on the chip unregistered.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment