Commit 2f697f6c authored by Sarah Sharp's avatar Sarah Sharp Committed by Greg Kroah-Hartman

USB: xhci: Set -EREMOTEIO when xHC gives bad transfer length.

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: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 204970a4
...@@ -1104,6 +1104,11 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -1104,6 +1104,11 @@ static int handle_tx_event(struct xhci_hcd *xhci,
"of %d bytes left\n", "of %d bytes left\n",
TRB_LEN(event->transfer_len)); TRB_LEN(event->transfer_len));
td->urb->actual_length = 0; 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 */ /* Don't overwrite a previously set error code */
if (status == -EINPROGRESS) { if (status == -EINPROGRESS) {
...@@ -1187,6 +1192,10 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -1187,6 +1192,10 @@ static int handle_tx_event(struct xhci_hcd *xhci,
urb->transfer_buffer_length, urb->transfer_buffer_length,
urb->actual_length); urb->actual_length);
urb->actual_length = 0; urb->actual_length = 0;
if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
status = -EREMOTEIO;
else
status = 0;
} }
list_del(&td->td_list); list_del(&td->td_list);
/* Was this TD slated to be cancelled but completed anyway? */ /* Was this TD slated to be cancelled but completed anyway? */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment