summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-08-05 13:05:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-08-05 10:23:19 -0700
commit580da34847488b404218d1d7f53b156f245f5555 (patch)
tree7164190a4f25d9b389c6103d41c6bc58b2071648
parentca5de404ff036a29b25e9a83f6919c9f606c5841 (diff)
downloadlinux-3.10-580da34847488b404218d1d7f53b156f245f5555.tar.gz
linux-3.10-580da34847488b404218d1d7f53b156f245f5555.tar.bz2
linux-3.10-580da34847488b404218d1d7f53b156f245f5555.zip
Fix USB storage hang on command abort
Okay, I found the cause of the hang. It is a simple bug in the USB scatter-gather library, caused by changes added in response to the S-G chaining modification. This patch (as1125) fixes a bug in the USB scatter-gather library. Early exit from the S-G initialization loop does not reset the count of outstanding URBs. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net> Cc: David Brownell <david-b@pacbell.net> Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: Greg KH <greg@kroah.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/usb/core/message.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 2fcc06eb5e6..586d6f1376c 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -389,7 +389,6 @@ int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev,
if (io->entries <= 0)
return io->entries;
- io->count = io->entries;
io->urbs = kmalloc(io->entries * sizeof *io->urbs, mem_flags);
if (!io->urbs)
goto nomem;
@@ -458,6 +457,7 @@ int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev,
io->urbs[--i]->transfer_flags &= ~URB_NO_INTERRUPT;
/* transaction state */
+ io->count = io->entries;
io->status = 0;
io->bytes = 0;
init_completion(&io->complete);