linux-stable/drivers/usb/core
Hans de Goede 6ec4147e7b usb-anchor: Delay usb_wait_anchor_empty_timeout wake up till completion is done
usb_wait_anchor_empty_timeout() should wait till the completion handler
has run. Both the zd1211rw driver and the uas driver (in its task mgmt) depend
on the completion handler having completed when usb_wait_anchor_empty_timeout()
returns, as they read state set by the completion handler after an
usb_wait_anchor_empty_timeout() call.

But __usb_hcd_giveback_urb() calls usb_unanchor_urb before calling the
completion handler. This is necessary as the completion handler may
re-submit and re-anchor the urb. But this introduces a race where the state
these drivers want to read has not been set yet by the completion handler
(this race is easily triggered with the uas task mgmt code).

I've considered adding an anchor_count to struct urb, which would be
incremented on anchor and decremented on unanchor, and then only actually
do the anchor / unanchor on 0 -> 1 and 1 -> 0 transtions, combined with
moving the unanchor call in hcd_giveback_urb to after calling the completion
handler. But this will only work if urb's are only re-anchored to the same
anchor as they were anchored to before the completion handler ran.

And at least one driver re-anchors to another anchor from the completion
handler (rtlwifi).

So I have come up with this patch instead, which adds the ability to
suspend wakeups of usb_wait_anchor_empty_timeout() waiters to the usb_anchor
functionality, and uses this in __usb_hcd_giveback_urb() to delay wake-ups
until the completion handler has run.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-11 16:33:58 -07:00
..
buffer.c usb: fix some scripts/kernel-doc warnings 2013-08-03 11:30:14 +08:00
config.c usb: config->desc.bLength may not exceed amount of data returned by the device 2013-08-12 12:24:27 -07:00
devices.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
devio.c Merge 3.12-rc3 into usb-next 2013-09-29 18:45:55 -07:00
driver.c USB: core: use DRIVER_ATTR_RW() 2013-08-23 15:12:14 -07:00
endpoint.c USB: core: be specific about attribute permissions 2013-08-25 15:12:03 -07:00
file.c usb: fix some scripts/kernel-doc warnings 2013-08-03 11:30:14 +08:00
generic.c USB: avoid error messages when a device is disconnected 2013-03-28 11:05:52 -07:00
hcd-pci.c usb: core: implement AMD remote wakeup quirk 2013-09-25 17:24:37 -07:00
hcd.c usb-anchor: Delay usb_wait_anchor_empty_timeout wake up till completion is done 2013-10-11 16:33:58 -07:00
hub.c usb: Remove unnecessary semicolons 2013-10-11 16:26:46 -07:00
hub.h USB: global suspend and remote wakeup don't mix 2013-07-16 15:33:02 -07:00
Kconfig USB: remove remaining instances of USB_SUSPEND 2013-05-15 13:44:44 -04:00
Makefile usb: Add driver/usb/core/(port.c,hub.h) files 2013-01-18 15:49:00 -08:00
message.c usb: fix some scripts/kernel-doc warnings 2013-08-03 11:30:14 +08:00
notify.c usb: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed 2011-10-31 19:31:25 -04:00
otg_whitelist.h
port.c USB: core: be specific about attribute permissions 2013-08-25 15:12:03 -07:00
quirks.c usb: core: usb_amd_resume_quirk() can be static 2013-09-26 11:56:50 -07:00
sysfs.c USB: fix substandard locking for the sysfs files 2013-09-25 17:27:01 -07:00
urb.c usb-anchor: Delay usb_wait_anchor_empty_timeout wake up till completion is done 2013-10-11 16:33:58 -07:00
usb-acpi.c usb/acpi: binding xhci root hub usb port with ACPI 2013-03-25 10:39:17 -07:00
usb.c usb: fix some scripts/kernel-doc warnings 2013-08-03 11:30:14 +08:00
usb.h usbcore: set lpm_capable field for LPM capable root hubs 2013-09-17 09:49:24 -07:00