aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohannes Stezenbach <js@sig21.net>2010-12-13 06:32:49 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-12-13 15:23:34 -0500
commitd7bb5f845f437662296adbfeaab8fbfce1c32289 (patch)
treed35d29fe6f9ea5806c8d0b962b0886142f416f6b /drivers
parent8d4ff3f3045e57f57634559c063bf70993a1d00a (diff)
rt2x00: fix hang when unplugging USB device in use
When an rt2x00 USB device is unplugged while in use, it reliably hangs the whole system. After some time the watchdog prints: BUG: soft lockup - CPU#0 stuck for 64s! [kworker/u:0:5] ... [<c01a88d8>] (usb_submit_urb+0x0/0x2ac) from [<bf0e752c>] (rt2x00usb_kick_rx_entry+0xb4/0xe8 [rt2x00usb]) [<bf0e7478>] (rt2x00usb_kick_rx_entry+0x0/0xe8 [rt2x00usb]) from [<bf0e7588>] (rt2x00usb_clear_entry+x28/0x2c [rt2x00usb]) [<bf0e7560>] (rt2x00usb_clear_entry+0x0/0x2c [rt2x00usb]) from [<bf0d5bc4>] (rt2x00lib_rxdone+0x2e0/0x2f8 [rt2x00lib]) [<bf0d58e4>] (rt2x00lib_rxdone+0x0/0x2f8 [rt2x00lib]) from [<bf0e7e00>] (rt2x00usb_work_rxdone+0x54/0x74 [rt2x00usb]) [<bf0e7dac>] (rt2x00usb_work_rxdone+0x0/0x74 [rt2x00usb]) from [<c00542b4>] (process_one_work+0x20c/0x35c) Clear the DEVICE_STATE_PRESENT flag when usb_submit_urb() returns -ENODEV to fix this. Signed-off-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 9ac14598e2a0..3a6c83e3a9c6 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -235,6 +235,7 @@ static void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
235 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev); 235 struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);
236 struct queue_entry_priv_usb *entry_priv = entry->priv_data; 236 struct queue_entry_priv_usb *entry_priv = entry->priv_data;
237 u32 length; 237 u32 length;
238 int status;
238 239
239 if (!test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags)) 240 if (!test_and_clear_bit(ENTRY_DATA_PENDING, &entry->flags))
240 return; 241 return;
@@ -251,7 +252,10 @@ static void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
251 entry->skb->data, length, 252 entry->skb->data, length,
252 rt2x00usb_interrupt_txdone, entry); 253 rt2x00usb_interrupt_txdone, entry);
253 254
254 if (usb_submit_urb(entry_priv->urb, GFP_ATOMIC)) { 255 status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
256 if (status) {
257 if (status == -ENODEV)
258 clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
255 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); 259 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
256 rt2x00lib_dmadone(entry); 260 rt2x00lib_dmadone(entry);
257 } 261 }
@@ -435,6 +439,7 @@ void rt2x00usb_clear_entry(struct queue_entry *entry)
435 to_usb_device_intf(entry->queue->rt2x00dev->dev); 439 to_usb_device_intf(entry->queue->rt2x00dev->dev);
436 struct queue_entry_priv_usb *entry_priv = entry->priv_data; 440 struct queue_entry_priv_usb *entry_priv = entry->priv_data;
437 int pipe; 441 int pipe;
442 int status;
438 443
439 entry->flags = 0; 444 entry->flags = 0;
440 445
@@ -445,7 +450,12 @@ void rt2x00usb_clear_entry(struct queue_entry *entry)
445 rt2x00usb_interrupt_rxdone, entry); 450 rt2x00usb_interrupt_rxdone, entry);
446 451
447 set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); 452 set_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
448 if (usb_submit_urb(entry_priv->urb, GFP_ATOMIC)) { 453
454 status = usb_submit_urb(entry_priv->urb, GFP_ATOMIC);
455 if (status) {
456 if (status == -ENODEV)
457 clear_bit(DEVICE_STATE_PRESENT,
458 &entry->queue->rt2x00dev->flags);
449 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags); 459 set_bit(ENTRY_DATA_IO_FAILED, &entry->flags);
450 rt2x00lib_dmadone(entry); 460 rt2x00lib_dmadone(entry);
451 } 461 }