]> err.no Git - linux-2.6/commitdiff
iwlwifi: fix oops in iwl3945_led_brightness_set
authorMarcin Slusarz <marcin.slusarz@gmail.com>
Sun, 8 Jun 2008 11:13:06 +0000 (13:13 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 9 Jun 2008 19:53:38 +0000 (15:53 -0400)
fix race between:
ieee80211_open->ieee80211_led_radio->led_trigger_event->led_set_brightness->iwl3945_led_brightness_set
(which assumes that "led->priv" is not NULL)
and
iwl3945_pci_probe->iwl3945_setup_deferred_work->(...)->iwl3945_bg_alive_start->iwl3945_alive_start->iwl3945_led_register->iwl3945_led_register_led
which sets priv field in struct iwl3945_led
after
led->led_dev.brightness_set = iwl3945_led_brightness_set;
(...)
led_classdev_register(device, &led->led_dev);

http://kerneloops.org/guilty.php?guilty=iwl3945_led_brightness_set&version=2.6.25-release&start=1671168&end=1703935&class=oops

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Zhu Yi <yi.zhu@intel.com>
Cc: Reinette Chatre <reinette.chatre@intel.com>
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: linux-wireless@vger.kernel.org
Cc: ipw3945-devel@lists.sourceforge.net
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-3945-led.c

index d200d08fb0863e4968a599ff548cc97024369d0d..8b1528e52d43ad12dc8948249bb52d9894292a74 100644 (file)
@@ -229,14 +229,15 @@ static int iwl3945_led_register_led(struct iwl3945_priv *priv,
        led->led_dev.brightness_set = iwl3945_led_brightness_set;
        led->led_dev.default_trigger = trigger;
 
+       led->priv = priv;
+       led->type = type;
+
        ret = led_classdev_register(device, &led->led_dev);
        if (ret) {
                IWL_ERROR("Error: failed to register led handler.\n");
                return ret;
        }
 
-       led->priv = priv;
-       led->type = type;
        led->registered = 1;
 
        if (set_led && led->led_on)