提交 e899a3f2 编写于 作者: M Michael Buesch 提交者: John W. Linville

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: NMichael Buesch <mb@bu3sch.de>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 9308779a
...@@ -112,10 +112,7 @@ static void b43_led_brightness_set(struct led_classdev *led_dev, ...@@ -112,10 +112,7 @@ static void b43_led_brightness_set(struct led_classdev *led_dev,
struct b43_led *led = container_of(led_dev, struct b43_led, led_dev); struct b43_led *led = container_of(led_dev, struct b43_led, led_dev);
struct b43_wl *wl = led->wl; struct b43_wl *wl = led->wl;
/* The check for current_dev is only needed while unregistering, if (likely(!wl->leds.stop)) {
* so it is sequencial and does not race. But we must not dereference
* current_dev here. */
if (likely(wl->current_dev)) {
atomic_set(&led->state, brightness); atomic_set(&led->state, brightness);
ieee80211_queue_work(wl->hw, &wl->leds.work); ieee80211_queue_work(wl->hw, &wl->leds.work);
} }
...@@ -314,6 +311,8 @@ void b43_leds_init(struct b43_wldev *dev) ...@@ -314,6 +311,8 @@ void b43_leds_init(struct b43_wldev *dev)
break; break;
} }
} }
dev->wl->leds.stop = 0;
} }
void b43_leds_exit(struct b43_wldev *dev) void b43_leds_exit(struct b43_wldev *dev)
......
...@@ -35,6 +35,7 @@ struct b43_leds { ...@@ -35,6 +35,7 @@ struct b43_leds {
struct b43_led led_radio; struct b43_led led_radio;
struct b43_led led_assoc; struct b43_led led_assoc;
bool stop;
struct work_struct work; struct work_struct work;
}; };
......
...@@ -4987,7 +4987,7 @@ static void b43_remove(struct ssb_device *dev) ...@@ -4987,7 +4987,7 @@ static void b43_remove(struct ssb_device *dev)
* might have modified it. Restoring is important, so the networking * might have modified it. Restoring is important, so the networking
* stack can properly free resources. */ * stack can properly free resources. */
wl->hw->queues = wl->mac80211_initially_registered_queues; wl->hw->queues = wl->mac80211_initially_registered_queues;
wl->current_dev = NULL; wl->leds.stop = 1;
cancel_work_sync(&wl->leds.work); cancel_work_sync(&wl->leds.work);
ieee80211_unregister_hw(wl->hw); ieee80211_unregister_hw(wl->hw);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册