]> err.no Git - linux-2.6/commitdiff
[PATCH] isp116x-hcd: fix handling of short transfers
authorOlav Kongas <ok@artecdesign.ee>
Mon, 17 Oct 2005 21:30:43 +0000 (14:30 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 17 Oct 2005 21:45:49 +0000 (14:45 -0700)
Increased use of scatter-gather by usb-storage driver after 2.6.13 has
exposed a buggy codepath in isp116x-hcd, which was probably never
visited before: bug happened only for those urbs, for which
URB_SHORT_NOT_OK was set AND short transfer occurred.

The fix attached was tested in 2 ways: (a) it fixed failing
initialization of a flash drive with an embedded hub; (b) the fix was
tested with 'usbtest' against a modified g_zero driver (on top of
net2280), which generated short bulk IN transfers of various lengths
including multiples and non-multiples of max_packet_length.

Signed-off-by: Olav Kongas <ok@artecdesign.ee>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/usb/host/isp116x-hcd.c

index 41bbae83fc713f3c686dc2ad4ec2c9399beee1fe..e142056b0d2cd5fc8c46e267564cc1ed2318033b 100644 (file)
@@ -326,7 +326,8 @@ static void postproc_atl_queue(struct isp116x *isp116x)
                                        usb_settoggle(udev, ep->epnum,
                                                      ep->nextpid ==
                                                      USB_PID_OUT,
-                                                     PTD_GET_TOGGLE(ptd) ^ 1);
+                                                     PTD_GET_TOGGLE(ptd));
+                               urb->actual_length += PTD_GET_COUNT(ptd);
                                urb->status = cc_to_error[TD_DATAUNDERRUN];
                                spin_unlock(&urb->lock);
                                continue;