]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
rtl8187: Fix kernel oops when device is removed when LEDS enabled
authorLarry Finger <Larry.Finger@lwfinger.net>
Wed, 4 Nov 2009 06:00:25 +0000 (00:00 -0600)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 8 Dec 2009 18:20:56 +0000 (10:20 -0800)
commit 37b12dd2b07b4d7dc222a5f7f88b25cec532b2aa upstream.

As reported by Rick Farina (sidhayn@gmail.com), removing the RTL8187
USB stick, or unloading the driver rtl8187 using rmmod will cause a
kernel oops.  There are at least two forms of the failure, (1) BUG:
Scheduling while atomic, and (2) a fatal kernel page fault. This
problem is reported in Bugzilla #14539.

This problem does not occur for kernel 2.6.31, but does for 2.6.32-rc2,
thus it is technically a regression; however, bisection did not locate
any faulty patch. The fix was found by comparing the faulty code in
rtl8187 with p54usb.  My interpretation is that the handling of work
queues in mac80211 changed enough to the LEDs to be unregistered
before tasks on the work queues are cancelled. Previously, these
actions could be done in either order.

(Herton Ronaldo Krzesinski <herton@mandriva.com.br> reports that the
code is the same in 2.6.31, so this may be a candidate for 2.6.31.x.
-- JWL)

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: Rick Farina <sidhayn@gmail.com>
Tested-by: Rick Farina <sidhayn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/wireless/rtl818x/rtl8187_leds.c

index cf9f899fe0e65dc876637db60d87e1e6013a49e7..75648dd17595608aefce6381c5fc6ae7ddea93d5 100644 (file)
@@ -210,10 +210,10 @@ void rtl8187_leds_exit(struct ieee80211_hw *dev)
 
        /* turn the LED off before exiting */
        queue_delayed_work(dev->workqueue, &priv->led_off, 0);
-       cancel_delayed_work_sync(&priv->led_off);
-       cancel_delayed_work_sync(&priv->led_on);
        rtl8187_unregister_led(&priv->led_rx);
        rtl8187_unregister_led(&priv->led_tx);
+       cancel_delayed_work_sync(&priv->led_off);
+       cancel_delayed_work_sync(&priv->led_on);
 }
 #endif /* def CONFIG_RTL8187_LED */