diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2009-08-28 14:28:18 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-10-05 09:32:52 -0700 |
commit | 6b65d1c68d84f301a087f9874431780ed71b90d7 (patch) | |
tree | 3deda8d741544a8a51811134e9bd07d0ba55c14e | |
parent | ff17e475b70b0168aa89e8726679bfedd044b998 (diff) |
USB: xhci: Set -EREMOTEIO when xHC gives bad transfer length.
commit 2f697f6cbff155b3ce4053a50cdf00b5be4dda11 upstream.
The xHCI hardware reports the number of bytes untransferred for a given
transfer buffer. If the hardware reports a bytes untransferred value
greater than the submitted buffer size, we want to play it safe and say no
data was transferred. If the driver considers a short packet to be an
error, remember to set -EREMOTEIO.
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index d264f9a6c559..aac379e1c883 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1104,6 +1104,11 @@ static int handle_tx_event(struct xhci_hcd *xhci, "of %d bytes left\n", TRB_LEN(event->transfer_len)); td->urb->actual_length = 0; + if (td->urb->transfer_flags & + URB_SHORT_NOT_OK) + status = -EREMOTEIO; + else + status = 0; } /* Don't overwrite a previously set error code */ if (status == -EINPROGRESS) { @@ -1187,6 +1192,10 @@ td_cleanup: urb->transfer_buffer_length, urb->actual_length); urb->actual_length = 0; + if (td->urb->transfer_flags & URB_SHORT_NOT_OK) + status = -EREMOTEIO; + else + status = 0; } list_del(&td->td_list); /* Was this TD slated to be cancelled but completed anyway? */ |