Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Sarah Sharp and committed by
Greg Kroah-Hartman
2f697f6c 204970a4

+9
+9
drivers/usb/host/xhci-ring.c
··· 1104 1104 "of %d bytes left\n", 1105 1105 TRB_LEN(event->transfer_len)); 1106 1106 td->urb->actual_length = 0; 1107 + if (td->urb->transfer_flags & 1108 + URB_SHORT_NOT_OK) 1109 + status = -EREMOTEIO; 1110 + else 1111 + status = 0; 1107 1112 } 1108 1113 /* Don't overwrite a previously set error code */ 1109 1114 if (status == -EINPROGRESS) { ··· 1192 1187 urb->transfer_buffer_length, 1193 1188 urb->actual_length); 1194 1189 urb->actual_length = 0; 1190 + if (td->urb->transfer_flags & URB_SHORT_NOT_OK) 1191 + status = -EREMOTEIO; 1192 + else 1193 + status = 0; 1195 1194 } 1196 1195 list_del(&td->td_list); 1197 1196 /* Was this TD slated to be cancelled but completed anyway? */