Commit 70247c61 authored by Matthew Dharm's avatar Matthew Dharm Committed by Greg Kroah-Hartman

[PATCH] USB: Patch to signal underflow in usb-storage driver

This patch causes the usb-storage driver to return an error indication
(DID_ERROR together with SUGGEST_RETRY) when the amount transferred by a
SCSI command is smaller than the "underflow" amount.  Some devices, like
the iRiver H100 series, occasionally transfer 0 bytes with GOOD status.
This change will make the sd driver aware that something unexpected has
happened so it can retry the command.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarMatthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 1aa8cfa8
......@@ -708,6 +708,12 @@ void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
srb->sense_buffer[0] = 0x0;
}
}
/* Did we transfer less than the minimum amount required? */
if (srb->result == SAM_STAT_GOOD &&
srb->request_bufflen - srb->resid < srb->underflow)
srb->result = (DID_ERROR << 16) | (SUGGEST_RETRY << 24);
return;
/* abort processing: the bulk-only transport requires a reset
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment