[PATCH] SCSI: handle HARDWARE_ERROR sense correctly

Alan Stern
2008-12-04T20:49:07Z

This patch (as1183) fixes a bug in scsi_check_sense(). The routine is
documented as returning one of SUCCESS, FAILED, or NEEDS_RETRY. But
in the HARDWARE_ERROR case it can return ADD_TO_MLQUEUE. And since it
does this without bothering to increment the retry count, it can lead
to an infinite retry loop.

The fix is to return NEEDS_RETRY instead. Then the caller,
scsi_decide_disposition(), will do the right thing.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

---

Index: usb-2.6/drivers/scsi/scsi_error.c
===================================================================
--- usb-2.6.orig/drivers/scsi/scsi_error.c
+++ usb-2.6/drivers/scsi/scsi_error.c
@@ -330,7 +330,7 @@ static int scsi_check_sense(struct scsi_

case HARDWARE_ERROR:
if (scmd->device->retry_hwerror)
- return ADD_TO_MLQUEUE;
+ return NEEDS_RETRY;
else
return SUCCESS;