]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
xhci: fix reporting of 0-sized URBs in control endpoint
authorAleksander Morgado <aleksander@aleksander.es>
Fri, 6 Mar 2015 15:14:21 +0000 (17:14 +0200)
committerJiri Slaby <jslaby@suse.cz>
Thu, 12 Mar 2015 16:31:15 +0000 (17:31 +0100)
commitf2a7b61c4d10ebf1ce21287d2ba28f3f88618d74
treec0813162e0d7e5031c69eae596d97ec932916b39
parentbbadcecc9b8e3e120c1240d64e44683c39e32872
xhci: fix reporting of 0-sized URBs in control endpoint

commit 45ba2154d12fc43b70312198ec47085f10be801a upstream.

When a control transfer has a short data stage, the xHCI controller generates
two transfer events: a COMP_SHORT_TX event that specifies the untransferred
amount, and a COMP_SUCCESS event. But when the data stage is not short, only the
COMP_SUCCESS event occurs. Therefore, xhci-hcd must set urb->actual_length to
urb->transfer_buffer_length while processing the COMP_SUCCESS event, unless
urb->actual_length was set already by a previous COMP_SHORT_TX event.

The driver checks this by seeing whether urb->actual_length == 0, but this alone
is the wrong test, as it is entirely possible for a short transfer to have an
urb->actual_length = 0.

This patch changes the xhci driver to rely on a new td->urb_length_set flag,
which is set to true when a COMP_SHORT_TX event is received and the URB length
updated at that stage.

This fixes a bug which affected the HSO plugin, which relies on URBs with
urb->actual_length == 0 to halt re-submitting the RX URB in the control
endpoint.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.h