linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtl8187: Fix kernel oops when device is removed when LEDS enabled (Bugzilla #14539)
@ 2009-11-04  6:00 Larry Finger
  2009-11-04 15:11 ` John W. Linville
  0 siblings, 1 reply; 14+ messages in thread
From: Larry Finger @ 2009-11-04  6:00 UTC (permalink / raw)
  To: John W Linville
  Cc: Herton Ronaldo Krzesinski, Hin-Tak Leung, sidhayn, linux-wireless

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.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Reported-and-tested by: Rick Farina <sidhayn@gmail.com>
---

John,

This is 2.6.32 material. Sorry to take so long to get a patch, but it was
difficult for me to locate the problem. Fortunately, I had the postings of the
two flame wars to amuse me while all the kernel compilations were happening.

Larry
---

Index: wireless-testing/drivers/net/wireless/rtl818x/rtl8187_leds.c
===================================================================
--- wireless-testing.orig/drivers/net/wireless/rtl818x/rtl8187_leds.c
+++ wireless-testing/drivers/net/wireless/rtl818x/rtl8187_leds.c
@@ -210,10 +210,10 @@ void rtl8187_leds_exit(struct ieee80211_
 
 	/* turn the LED off before exiting */
 	ieee80211_queue_delayed_work(dev, &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 */
 

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-11-05  6:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04  6:00 [PATCH] rtl8187: Fix kernel oops when device is removed when LEDS enabled (Bugzilla #14539) Larry Finger
2009-11-04 15:11 ` John W. Linville
2009-11-04 15:30   ` Christian Lamparter
2009-11-04 16:49     ` John W. Linville
2009-11-05  0:14       ` Herton Ronaldo Krzesinski
2009-11-05  2:34         ` Larry Finger
2009-11-05  4:55           ` Richard Farina
2009-11-05  5:16             ` Larry Finger
2009-11-04 15:54   ` Larry Finger
2009-11-04 16:54     ` John W. Linville
2009-11-04 18:13       ` Larry Finger
2009-11-04 18:47         ` John W. Linville
2009-11-05  4:57           ` Richard Farina
2009-11-05  6:00           ` Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).