USB: xhci: Check URB_SHORT_NOT_OK before setting short packet status.
authorSarah Sharp <sarah.a.sharp@linux.intel.com>
Fri, 28 Aug 2009 21:28:15 +0000 (14:28 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Sep 2009 13:46:18 +0000 (06:46 -0700)
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>
drivers/usb/host/xhci-ring.c

index b4fab00105d4d984447afed2c68bc1adc16d8d5d..d264f9a6c559cd20a2b96d25504cc4dfa1c9df0e 100644 (file)
@@ -991,7 +991,10 @@ static int handle_tx_event(struct xhci_hcd *xhci,
                        break;
                case COMP_SHORT_TX:
                        xhci_warn(xhci, "WARN: short transfer on control ep\n");
-                       status = -EREMOTEIO;
+                       if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
+                               status = -EREMOTEIO;
+                       else
+                               status = 0;
                        break;
                case COMP_BABBLE:
                        /* The 0.96 spec says a babbling control endpoint
@@ -1034,7 +1037,10 @@ static int handle_tx_event(struct xhci_hcd *xhci,
                        if (event_trb == td->last_trb) {
                                if (td->urb->actual_length != 0) {
                                        /* Don't overwrite a previously set error code */
-                                       if (status == -EINPROGRESS || status == 0)
+                                       if ((status == -EINPROGRESS ||
+                                                               status == 0) &&
+                                                       (td->urb->transfer_flags
+                                                        & URB_SHORT_NOT_OK))
                                                /* Did we already see a short data stage? */
                                                status = -EREMOTEIO;
                                } else {