diff options
author | Oleksij Rempel <bug-track@fisher-privat.net> | 2012-06-05 14:39:32 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-06-08 13:47:06 -0400 |
commit | e64add27e1b4874f589e550b4e0ca6715070373f (patch) | |
tree | 946313bd3ce6f26c150266d974921b64c1407b58 /drivers/net/wireless/b43/main.c | |
parent | d2c8b15d0cb486f4938ba7f2af349d9d1220cb10 (diff) |
b43: do not call ieee80211_unregister_hw if we are not registred
this patch fixes kernel Oops on "rmmod b43" if firmware was not loaded:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000088
IP: [<ffffffff8104e988>] drain_workqueue+0x25/0x142
PGD 153ac6067 PUD 153b82067 PMD 0
Oops: 0000 [#1] SMP
Signed-off-by: Oleksij Rempel <bug-track@fisher-privat.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/main.c')
-rw-r--r-- | drivers/net/wireless/b43/main.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 5a39b226b2e3..acd03a4f9730 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -2437,6 +2437,7 @@ start_ieee80211: | |||
2437 | err = ieee80211_register_hw(wl->hw); | 2437 | err = ieee80211_register_hw(wl->hw); |
2438 | if (err) | 2438 | if (err) |
2439 | goto err_one_core_detach; | 2439 | goto err_one_core_detach; |
2440 | wl->hw_registred = true; | ||
2440 | b43_leds_register(wl->current_dev); | 2441 | b43_leds_register(wl->current_dev); |
2441 | goto out; | 2442 | goto out; |
2442 | 2443 | ||
@@ -5299,6 +5300,7 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) | |||
5299 | 5300 | ||
5300 | hw->queues = modparam_qos ? B43_QOS_QUEUE_NUM : 1; | 5301 | hw->queues = modparam_qos ? B43_QOS_QUEUE_NUM : 1; |
5301 | wl->mac80211_initially_registered_queues = hw->queues; | 5302 | wl->mac80211_initially_registered_queues = hw->queues; |
5303 | wl->hw_registred = false; | ||
5302 | hw->max_rates = 2; | 5304 | hw->max_rates = 2; |
5303 | SET_IEEE80211_DEV(hw, dev->dev); | 5305 | SET_IEEE80211_DEV(hw, dev->dev); |
5304 | if (is_valid_ether_addr(sprom->et1mac)) | 5306 | if (is_valid_ether_addr(sprom->et1mac)) |
@@ -5370,12 +5372,15 @@ static void b43_bcma_remove(struct bcma_device *core) | |||
5370 | * as the ieee80211 unreg will destroy the workqueue. */ | 5372 | * as the ieee80211 unreg will destroy the workqueue. */ |
5371 | cancel_work_sync(&wldev->restart_work); | 5373 | cancel_work_sync(&wldev->restart_work); |
5372 | 5374 | ||
5373 | /* Restore the queues count before unregistering, because firmware detect | 5375 | B43_WARN_ON(!wl); |
5374 | * might have modified it. Restoring is important, so the networking | 5376 | if (wl->current_dev == wldev && wl->hw_registred) { |
5375 | * stack can properly free resources. */ | 5377 | /* Restore the queues count before unregistering, because firmware detect |
5376 | wl->hw->queues = wl->mac80211_initially_registered_queues; | 5378 | * might have modified it. Restoring is important, so the networking |
5377 | b43_leds_stop(wldev); | 5379 | * stack can properly free resources. */ |
5378 | ieee80211_unregister_hw(wl->hw); | 5380 | wl->hw->queues = wl->mac80211_initially_registered_queues; |
5381 | b43_leds_stop(wldev); | ||
5382 | ieee80211_unregister_hw(wl->hw); | ||
5383 | } | ||
5379 | 5384 | ||
5380 | b43_one_core_detach(wldev->dev); | 5385 | b43_one_core_detach(wldev->dev); |
5381 | 5386 | ||
@@ -5446,7 +5451,7 @@ static void b43_ssb_remove(struct ssb_device *sdev) | |||
5446 | cancel_work_sync(&wldev->restart_work); | 5451 | cancel_work_sync(&wldev->restart_work); |
5447 | 5452 | ||
5448 | B43_WARN_ON(!wl); | 5453 | B43_WARN_ON(!wl); |
5449 | if (wl->current_dev == wldev) { | 5454 | if (wl->current_dev == wldev && wl->hw_registred) { |
5450 | /* Restore the queues count before unregistering, because firmware detect | 5455 | /* Restore the queues count before unregistering, because firmware detect |
5451 | * might have modified it. Restoring is important, so the networking | 5456 | * might have modified it. Restoring is important, so the networking |
5452 | * stack can properly free resources. */ | 5457 | * stack can properly free resources. */ |