Skip to contentSkip to conversation

Patch "usb: misc: usbtest: add fix for driver hang" has been added to the 4.7-stable tree

PATCH [email protected] 1 participant 1 message Sep 2, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

usb: misc: usbtest: add fix for driver hang

to the 4.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
usb-misc-usbtest-add-fix-for-driver-hang.patch
and it can be found in the queue-4.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 539587511835ea12d8daa444cbed766cf2bc3612 Mon Sep 17 00:00:00 2001

From: Lu Baolu <[email protected]>
Date: Thu, 11 Aug 2016 10:31:14 +0800
Subject: usb: misc: usbtest: add fix for driver hang

From: Lu Baolu <[email protected]>

commit 539587511835ea12d8daa444cbed766cf2bc3612 upstream.

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.

---
 drivers/usb/misc/usbtest.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/misc/usbtest.c +4 -3
@@ -585,7 +585,6 @@ static void sg_timeout(unsigned long _re
 {
 	struct usb_sg_request	*req = (struct usb_sg_request *) _req;
 
-	req->status = -ETIMEDOUT;
 	usb_sg_cancel(req);
 }
 
@@ -616,8 +615,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 */
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.7/usb-misc-usbtest-add-fix-for-driver-hang.patch