[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#355883: Same problem here



Bastian Blank a écrit :
> On Tue, Aug 19, 2008 at 06:50:11PM +0200, Adam Cécile (Le_Vert) wrote:
>   
>> I can confirm this bug 2.6.26-1-amd64 and a slightly modified rebuild of
>> the i386 flavour.
>> My usb stick is unusable.
>>     
>
> I doubt that you see the same bug. Try #494800.
>   
Check reply by Kumar Appaiah (20080812). He re-opened this bug against
kernel 2.6.26.
>   
>> I noticed severity has been dropped from important to normal. Any
>> justification ?
>>     
>
> Someone which is not submitter or maintainer changed it.
>
>   
>> I'd rather say it's critical. Everybody needs usb sticks....
>>     
>
> No. Many of my machines don't even have usb.
>   
No comment.
> Bastian
>   
I found the attached patch somewhere on lkml. It's targeted for kernel
2.6.27. I can confirm this patch fix the issue with my stick.

Regards, Adam.

--- drivers/usb/storage/transport.c	2008-07-13 21:51:29.000000000 +0000
+++ drivers/usb/storage/transport.c.new	2008-08-19 17:38:28.510241535 +0000
@@ -1034,8 +1034,21 @@
 
 	/* try to compute the actual residue, based on how much data
 	 * was really transferred and what the device tells us */
-	if (residue) {
-		if (!(us->flags & US_FL_IGNORE_RESIDUE)) {
+        if (residue && !(us->flags & US_FL_IGNORE_RESIDUE)) {
+
+                /* Heuristically detect devices that generate bogus residues
+                 * by seeing what happens with INQUIRY and READ CAPACITY
+                 * commands.
+                 */
+                if (bcs->Status == US_BULK_STAT_OK &&
+                                scsi_get_resid(srb) == 0 &&
+                                        ((srb->cmnd[0] == INQUIRY &&
+                                                transfer_length == 36) ||
+                                       (srb->cmnd[0] == READ_CAPACITY &&
+                                                transfer_length == 8))) {
+                        us->flags |= US_FL_IGNORE_RESIDUE;
+
+                } else {
 			residue = min(residue, transfer_length);
 			scsi_set_resid(srb, max(scsi_get_resid(srb),
 			                                       (int) residue));

Reply to: