diff options
author | Michael Buesch <mb@bu3sch.de> | 2009-09-14 17:22:08 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-09-23 11:35:45 -0400 |
commit | e899a3f232125c393cdf7f7bf6533501ef8808fb (patch) | |
tree | bf6dae95b5e9da612ccdc24f56807c66ca310d0a /drivers | |
parent | 9308779aad721cab8434fd5f98d3c85d3716fdec (diff) |
b43: Don't abuse wl->current_dev in the led work
Don't abuse wl->current_dev in the LED work for checking whether we're
going down. Add an explicit variable.
This fixes a crash on rmmod dereferencing the wl->current_dev NULL pointer
in various other places of the driver.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/b43/leds.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/b43/leds.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c index ac5a322c84b7..fbe31e02688b 100644 --- a/drivers/net/wireless/b43/leds.c +++ b/drivers/net/wireless/b43/leds.c | |||
@@ -112,10 +112,7 @@ static void b43_led_brightness_set(struct led_classdev *led_dev, | |||
112 | struct b43_led *led = container_of(led_dev, struct b43_led, led_dev); | 112 | struct b43_led *led = container_of(led_dev, struct b43_led, led_dev); |
113 | struct b43_wl *wl = led->wl; | 113 | struct b43_wl *wl = led->wl; |
114 | 114 | ||
115 | /* The check for current_dev is only needed while unregistering, | 115 | if (likely(!wl->leds.stop)) { |
116 | * so it is sequencial and does not race. But we must not dereference | ||
117 | * current_dev here. */ | ||
118 | if (likely(wl->current_dev)) { | ||
119 | atomic_set(&led->state, brightness); | 116 | atomic_set(&led->state, brightness); |
120 | ieee80211_queue_work(wl->hw, &wl->leds.work); | 117 | ieee80211_queue_work(wl->hw, &wl->leds.work); |
121 | } | 118 | } |
@@ -314,6 +311,8 @@ void b43_leds_init(struct b43_wldev *dev) | |||
314 | break; | 311 | break; |
315 | } | 312 | } |
316 | } | 313 | } |
314 | |||
315 | dev->wl->leds.stop = 0; | ||
317 | } | 316 | } |
318 | 317 | ||
319 | void b43_leds_exit(struct b43_wldev *dev) | 318 | void b43_leds_exit(struct b43_wldev *dev) |
diff --git a/drivers/net/wireless/b43/leds.h b/drivers/net/wireless/b43/leds.h index c4a58a0fc1d5..49d3da540c28 100644 --- a/drivers/net/wireless/b43/leds.h +++ b/drivers/net/wireless/b43/leds.h | |||
@@ -35,6 +35,7 @@ struct b43_leds { | |||
35 | struct b43_led led_radio; | 35 | struct b43_led led_radio; |
36 | struct b43_led led_assoc; | 36 | struct b43_led led_assoc; |
37 | 37 | ||
38 | bool stop; | ||
38 | struct work_struct work; | 39 | struct work_struct work; |
39 | }; | 40 | }; |
40 | 41 | ||
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 7fa947ca7c32..a8840ef63770 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -4987,7 +4987,7 @@ static void b43_remove(struct ssb_device *dev) | |||
4987 | * might have modified it. Restoring is important, so the networking | 4987 | * might have modified it. Restoring is important, so the networking |
4988 | * stack can properly free resources. */ | 4988 | * stack can properly free resources. */ |
4989 | wl->hw->queues = wl->mac80211_initially_registered_queues; | 4989 | wl->hw->queues = wl->mac80211_initially_registered_queues; |
4990 | wl->current_dev = NULL; | 4990 | wl->leds.stop = 1; |
4991 | cancel_work_sync(&wl->leds.work); | 4991 | cancel_work_sync(&wl->leds.work); |
4992 | ieee80211_unregister_hw(wl->hw); | 4992 | ieee80211_unregister_hw(wl->hw); |
4993 | } | 4993 | } |