Commit 1a8eadfa authored by Lu Baolu's avatar Lu Baolu Committed by Sasha Levin

usb: misc: usbtest: add fix for driver hang

[ Upstream commit 53958751 ]

In sg_timeout(), req->status is set to "-ETIMEDOUT" before calling
into usb_sg_cancel(). usb_sg_cancel() will do nothing and return
directly if req->status has been set to a non-zero value. This will
cause driver hang whenever transfer time out is triggered.

This patch fixes this issue. It could be backported to stable kernel
with version later than v3.15.

Cc: stable@vger.kernel.org # 3.15+
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Suggested-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 79e3a23f
......@@ -545,7 +545,6 @@ static void sg_timeout(unsigned long _req)
{
struct usb_sg_request *req = (struct usb_sg_request *) _req;
req->status = -ETIMEDOUT;
usb_sg_cancel(req);
}
......@@ -576,8 +575,10 @@ static int perform_sglist(
mod_timer(&sg_timer, jiffies +
msecs_to_jiffies(SIMPLE_IO_TIMEOUT));
usb_sg_wait(req);
del_timer_sync(&sg_timer);
retval = req->status;
if (!del_timer_sync(&sg_timer))
retval = -ETIMEDOUT;
else
retval = req->status;
/* FIXME check resulting data pattern */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment