diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index a69b155..383a3a8 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -934,6 +934,10 @@ static int sd_done(struct scsi_cmnd *SCpnt) goto out; switch (sshdr.sense_key) { + case RECOVERED_ERROR: + scsi_print_sense("sd", SCpnt); + SCpnt->result = 0; + /* fallthrough */ case HARDWARE_ERROR: case MEDIUM_ERROR: if (!blk_fs_request(SCpnt->request)) @@ -968,14 +972,14 @@ static int sd_done(struct scsi_cmnd *SCpnt) /* This computation should always be done in terms of * the resolution of the device's medium. */ + if (bad_lba < start_lba) + goto out; good_bytes = (bad_lba - start_lba)*SCpnt->device->sector_size; break; - case RECOVERED_ERROR: case NO_SENSE: /* Inform the user, but make sure that it's not treated * as a hard error. */ - scsi_print_sense("sd", SCpnt); SCpnt->result = 0; memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); good_bytes = xfer_size;