Hi Greg,

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.

I feel quite safe about the fix. Therefore if it is not yet 
too late for 2.6.14, I'd be happy to get it in there. Please 
apply.

Regards,
Olav
Fix handling of short IN data transfers for urbs with URB_SHORT_NOT_OK flag set.
This buggy codepath in the isp116x-hcd was exposed by increased use of 
scatter-gather
(which results in setting URB_SHORT_NOT_OK) in 2.6.14-rcX. The bug caused
initialization failures of a few USB storage devices.

Signed-off-by: Olav Kongas <[EMAIL PROTECTED]>

--- linux-2.6.14-rc4-or/drivers/usb/host/isp116x-hcd.c  2005-10-11 
04:19:19.000000000 +0300
+++ linux-2.6.14-rc4-tmp1/drivers/usb/host/isp116x-hcd.c        2005-10-17 
15:35:25.000000000 +0300
@@ -326,7 +326,8 @@ static void postproc_atl_queue(struct is
                                        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;

Reply via email to