Author: hselasky
Date: Tue Sep 20 14:17:58 2011
New Revision: 225695
URL: http://svn.freebsd.org/changeset/base/225695

Log:
  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

Modified:
  head/sys/dev/usb/usb_transfer.c

Modified: head/sys/dev/usb/usb_transfer.c
==============================================================================
--- head/sys/dev/usb/usb_transfer.c     Tue Sep 20 13:04:52 2011        
(r225694)
+++ head/sys/dev/usb/usb_transfer.c     Tue Sep 20 14:17:58 2011        
(r225695)
@@ -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 *p
 #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;
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to