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

USB: xhci: Check URB_SHORT_NOT_OK before setting short packet status.

Make sure that the driver that submitted the URB considers a short packet
an error before setting -EREMOTEIO during a short control transfer.

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
204970a4 99eb32db

+8 -2
+8 -2
drivers/usb/host/xhci-ring.c
··· 991 991 break; 992 992 case COMP_SHORT_TX: 993 993 xhci_warn(xhci, "WARN: short transfer on control ep\n"); 994 - status = -EREMOTEIO; 994 + if (td->urb->transfer_flags & URB_SHORT_NOT_OK) 995 + status = -EREMOTEIO; 996 + else 997 + status = 0; 995 998 break; 996 999 case COMP_BABBLE: 997 1000 /* The 0.96 spec says a babbling control endpoint ··· 1037 1034 if (event_trb == td->last_trb) { 1038 1035 if (td->urb->actual_length != 0) { 1039 1036 /* Don't overwrite a previously set error code */ 1040 - if (status == -EINPROGRESS || status == 0) 1037 + if ((status == -EINPROGRESS || 1038 + status == 0) && 1039 + (td->urb->transfer_flags 1040 + & URB_SHORT_NOT_OK)) 1041 1041 /* Did we already see a short data stage? */ 1042 1042 status = -EREMOTEIO; 1043 1043 } else {