UAS: Re-add workqueue items if submission fails.
authorSarah Sharp <sarah.a.sharp@linux.intel.com>
Fri, 2 Dec 2011 19:55:44 +0000 (11:55 -0800)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 30 Apr 2012 18:15:14 +0000 (19:15 +0100)
commit22085fef71cd05eb13470f0acd856f7bb3a119c1
tree241a78b3fd7db26a3c316207a6f1aadaee0cd13a
parent972f5642c79f22155dbf02d68d5d100a96bd0051
UAS: Re-add workqueue items if submission fails.

BugLink: http://bugs.launchpad.net/bugs/901215

If the original submission (or allocation) of the URBs for a SCSI
command fails, the UAS driver sticks the command structure in a
workqueue and schedules uas_do_work() to run.  That function removes the
entire queue before walking across it and attempting to resubmit.

Unfortunately, if the second submission fails, we will leak memory
(because an allocated URB was not submitted) and possibly leave the SCSI
command partially enqueued on some of the stream rings.  Fix this by
checking whether the second submission failed and re-queueing the
command to the UAS workqueue and scheduling it.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
(cherry picked from commit ea9da1c79eb9a28176550d0b8ba9166e6e5f42b8)

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Herton Krzesinski <herton.krzesinski@canonical.com>
drivers/usb/storage/uas.c