* [PATCH 1/2] brcmsmac: fix deadlock on missing firmware
@ 2014-03-09 20:06 Emil Goode
2014-03-09 20:06 ` [PATCH 2/2] brcmsmac: update comment to reflect the code Emil Goode
0 siblings, 1 reply; 2+ messages in thread
From: Emil Goode @ 2014-03-09 20:06 UTC (permalink / raw)
To: Brett Rudley, Arend van Spriel, Franky (Zhenhui) Lin,
Hante Meuleman, John W. Linville, Hauke Mehrtens, Johannes Berg,
Luis R. Rodriguez
Cc: linux-wireless, brcm80211-dev-list, netdev, linux-kernel,
Emil Goode
When brcm80211 firmware is not installed networking hangs.
A deadlock happens because we call ieee80211_unregister_hw()
from the .start callback of struct ieee80211_ops. When .start
is called we are under rtnl lock and ieee80211_unregister_hw()
tries to take it again.
Function call stack:
dev_change_flags()
__dev_change_flags()
__dev_open()
ASSERT_RTNL() <-- Assert rtnl lock
ops->ndo_open()
.ndo_open = ieee80211_open,
ieee80211_open()
ieee80211_do_open()
drv_start()
local->ops->start()
.start = brcms_ops_start,
brcms_ops_start()
brcms_remove()
ieee80211_unregister_hw()
rtnl_lock() <-- Here we deadlock
Introduced by:
commit 25b5632fb35ca61b8ae3eee235edcdc2883f7a5e
("brcmsmac: request firmware in .start() callback")
This patch fixes the bug by removing the call to brcms_remove()
and moves the brcms_request_fw() call to the top of the .start
callback to not initiate anything unless firmware is installed.
Signed-off-by: Emil Goode <emilgoode@gmail.com>
---
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index 925034b..93598cd 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -426,6 +426,12 @@ static int brcms_ops_start(struct ieee80211_hw *hw)
bool blocked;
int err;
+ if (!wl->ucode.bcm43xx_bomminor) {
+ err = brcms_request_fw(wl, wl->wlc->hw->d11core);
+ if (err)
+ return -ENOENT;
+ }
+
ieee80211_wake_queues(hw);
spin_lock_bh(&wl->lock);
blocked = brcms_rfkill_set_hw_state(wl);
@@ -433,14 +439,6 @@ static int brcms_ops_start(struct ieee80211_hw *hw)
if (!blocked)
wiphy_rfkill_stop_polling(wl->pub->ieee_hw->wiphy);
- if (!wl->ucode.bcm43xx_bomminor) {
- err = brcms_request_fw(wl, wl->wlc->hw->d11core);
- if (err) {
- brcms_remove(wl->wlc->hw->d11core);
- return -ENOENT;
- }
- }
-
spin_lock_bh(&wl->lock);
/* avoid acknowledging frames before a non-monitor device is added */
wl->mute_tx = true;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH 2/2] brcmsmac: update comment to reflect the code
2014-03-09 20:06 [PATCH 1/2] brcmsmac: fix deadlock on missing firmware Emil Goode
@ 2014-03-09 20:06 ` Emil Goode
0 siblings, 0 replies; 2+ messages in thread
From: Emil Goode @ 2014-03-09 20:06 UTC (permalink / raw)
To: Brett Rudley, Arend van Spriel, Franky (Zhenhui) Lin,
Hante Meuleman, John W. Linville, Hauke Mehrtens, Johannes Berg,
Luis R. Rodriguez
Cc: linux-wireless, brcm80211-dev-list, netdev, linux-kernel,
Emil Goode
The brcms_attach function is defined as static but the comment is
saying that it should not be static or gcc will issue a warning.
I believe we can remove the comment as I don't se a problem with
this function being defined as static.
Signed-off-by: Emil Goode <emilgoode@gmail.com>
---
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index 93598cd..8c5fa4e 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -1092,12 +1092,6 @@ static int ieee_hw_init(struct ieee80211_hw *hw)
* Attach to the WL device identified by vendor and device parameters.
* regs is a host accessible memory address pointing to WL device registers.
*
- * brcms_attach is not defined as static because in the case where no bus
- * is defined, wl_attach will never be called, and thus, gcc will issue
- * a warning that this function is defined but not used if we declare
- * it as static.
- *
- *
* is called in brcms_bcma_probe() context, therefore no locking required.
*/
static struct brcms_info *brcms_attach(struct bcma_device *pdev)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-09 20:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-09 20:06 [PATCH 1/2] brcmsmac: fix deadlock on missing firmware Emil Goode
2014-03-09 20:06 ` [PATCH 2/2] brcmsmac: update comment to reflect the code Emil Goode
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).