From: Alan Stern Date: Tue, 5 Aug 2008 17:05:17 +0000 (-0400) Subject: Fix USB storage hang on command abort X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=580da34847488b404218d1d7f53b156f245f5555;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Cc: Matthew Dharm Cc: David Brownell Cc: Alan Jenkins Cc: James Bottomley Cc: Greg KH Signed-off-by: Linus Torvalds --- diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 2fcc06eb5e60..586d6f1376cf 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);