On Thu, 12 Jul 2007 16:42:33 -0700, Greg Kroah-Hartman <[EMAIL PROTECTED]> 
wrote:

Hi, Greg:

>  drivers/usb/class/usblp.c |  618 
> +++++++++++++++++++++++++++------------------

I found a bug in this patch and sent a fix this Tuesday. Please make
sure it goes to Linus as well.

Sorry about that.

-- Pete

--- Begin Forwarded Message ---

From: Pete Zaitcev <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: linux-usb-devel@lists.sourceforge.net, [EMAIL PROTECTED]
Subject: usblp: "Big cleanup" breaks O_NONBLOCK
Date: Tue, 10 Jul 2007 20:09:58 -0700

I found the first regresson in the rewritten ("all dynamic" and "no races")
driver. If application uses O_NONBLOCK, I return -EAGAIN despite the URB
being submitted successfuly. This causes the application to resubmit the
same data erroneously.

The fix is to pretend that the transfer has succeeded even if URB was
merely queued. It is the same behaviour as with the old version.

Signed-off-by: Pete Zaitcev <[EMAIL PROTECTED]>

--- linux-2.6.22-gregkh/drivers/usb/class/usblp.c       2007-07-10 
19:40:48.000000000 -0700
+++ linux-2.6.22-gregkh-eagain/drivers/usb/class/usblp.c        2007-07-10 
19:45:49.000000000 -0700
@@ -741,10 +741,11 @@ static ssize_t usblp_write(struct file *
                 */
                rv = usblp_wwait(usblp, !!(file->f_flags&O_NONBLOCK));
                if (rv < 0) {
-                       /*
-                        * If interrupted, we simply leave the URB to dangle,
-                        * so the ->release will call usb_kill_urb().
-                        */
+                       if (rv == -EAGAIN) {
+                               /* Presume that it's going to complete well. */
+                               writecount += transfer_length;
+                       }
+                       /* Leave URB dangling, to be cleaned on close. */
                        goto collect_error;
                }
 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to