]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
USB: ene_usb6250: fix SCSI residue overwriting
authorAlan Stern <stern@rowland.harvard.edu>
Tue, 16 May 2017 15:47:52 +0000 (11:47 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 May 2017 14:05:24 +0000 (16:05 +0200)
In the ene_usb6250 sub-driver for usb-storage, the SCSI residue is not
reported correctly.  The residue is initialized to 0, but this value
is overwritten whenever the driver sends firmware to the card reader
before performing the current command.  As a result, a valid READ or
WRITE operation appears to have failed, causing the SCSI core to retry
the command multiple times and eventually fail.

This patch fixes the problem by resetting the SCSI residue to 0 after
sending firmware to the device.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: Andreas Hartmann <andihartmann@01019freenet.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/ene_ub6250.c

index 80cd67841074bf290dbd196a85eddb9e149b186a..10701844755177256f91264885dd68f11c603988 100644 (file)
@@ -1929,6 +1929,8 @@ static int ene_load_bincode(struct us_data *us, unsigned char flag)
        bcb->CDB[0] = 0xEF;
 
        result = ene_send_scsi_cmd(us, FDIR_WRITE, buf, 0);
+       if (us->srb != NULL)
+               scsi_set_resid(us->srb, 0);
        info->BIN_FLAG = flag;
        kfree(buf);