linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] libertas USB: don't set surpriseremoved flag
@ 2012-07-15 22:48 Daniel Drake
  0 siblings, 0 replies; only message in thread
From: Daniel Drake @ 2012-07-15 22:48 UTC (permalink / raw)
  To: dcbw, linville; +Cc: linux-wireless, libertas-dev

We found a deadlock in the handling of command failures/reset conditions.
For example:

 1. Two commands are in the queue.
 2. The first command is sent, but causes a timeout, which kicks off an
    asynchronous device reset
 3. The second command is queued (but not yet sent to the hardware)
 4. The device reset kicks in, causing the if_usb disconnect handler to
    set the "surprise removed" flag to be set as the device disappears
    from the bus. This causes lbs_thread to stop processing things
    ("adapter removed; waiting to die"), not processing any further
    commands, leaving the second queued command "in the air", causing a
    deadlock.

Fix this by removing the surpriseremoved flag setting in if_usb. I can't
see any reason why this needs to be done so early. lbs_remove_card will set
this flag at an appropriate time - i.e. after all pending commands have
been completed or cancelled, avoiding this deadlock.

Signed-off-by: Daniel Drake <dsd@laptop.org>
---
 drivers/net/wireless/libertas/if_usb.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index cd3b0d4..92b6885 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -309,7 +309,6 @@ static void if_usb_disconnect(struct usb_interface *intf)
 	cardp->surprise_removed = 1;
 
 	if (priv) {
-		priv->surpriseremoved = 1;
 		lbs_stop_card(priv);
 		lbs_remove_card(priv);
 	}
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-15 22:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-15 22:48 [PATCH 3/3] libertas USB: don't set surpriseremoved flag Daniel Drake

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).