Avoid starting the USB transfer if an error is already pending.

This change fixes a race in device side mode during clear-stall from
host, which can cause data to be sent too early on the given
endpoint.

Approved by:	re (kib)
MFC after:	1 week
This commit is contained in:
hselasky 2011-09-20 14:17:58 +00:00
parent 8bc7d7cad3
commit 8139b983c9

View File

@ -2417,8 +2417,9 @@ usbd_transfer_start_cb(void *arg)
#if USB_HAVE_PF
usbpf_xfertap(xfer, USBPF_XFERTAP_SUBMIT);
#endif
/* start the transfer */
(ep->methods->start) (xfer);
/* start USB transfer, if no error */
if (xfer->error == 0)
(ep->methods->start) (xfer);
xfer->flags_int.can_cancel_immed = 1;
@ -2597,8 +2598,9 @@ usbd_pipe_start(struct usb_xfer_queue *pq)
#if USB_HAVE_PF
usbpf_xfertap(xfer, USBPF_XFERTAP_SUBMIT);
#endif
/* start USB transfer */
(ep->methods->start) (xfer);
/* start USB transfer, if no error */
if (xfer->error == 0)
(ep->methods->start) (xfer);
xfer->flags_int.can_cancel_immed = 1;