All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [SCSI] sd: make error handling more robust (v2)
@ 2008-02-01 17:03 Tony Battersby
  2008-02-01 20:13 ` Luben Tuikov
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Tony Battersby @ 2008-02-01 17:03 UTC (permalink / raw)
  To: linux-scsi@vger.kernel.org, James Bottomley; +Cc: Luben Tuikov, Salyzyn, Mark

This patch fixes a problem with some out-of-spec SCSI disks that report
hardware or medium errors incorrectly.  Without the patch, the kernel
may silently ignore a failed write command or return corrupted data on a
failed read command.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
---

This is a simplified version of the original patch that fixes just the
problem at hand, without trying to handle other theoretical out-of-spec
cases.

Applies to kernels 2.6.18 - 2.6.24-git10+.

--- linux-2.6.24-git10/drivers/scsi/sd.c.orig	2008-02-01 11:24:37.000000000 -0500
+++ linux-2.6.24-git10/drivers/scsi/sd.c	2008-02-01 11:26:12.000000000 -0500
@@ -990,6 +990,8 @@ static int sd_done(struct scsi_cmnd *SCp
 		/* 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:



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-02-06 22:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-01 17:03 [PATCH] [SCSI] sd: make error handling more robust (v2) Tony Battersby
2008-02-01 20:13 ` Luben Tuikov
2008-02-01 20:47 ` Salyzyn, Mark
2008-02-02  0:43   ` Mike Snitzer
2008-02-02 20:24     ` Greg KH
2008-02-02 20:56       ` Mike Snitzer
2008-02-02 21:08         ` Greg KH
2008-02-02 22:06 ` James Bottomley
2008-02-03 15:14   ` Mike Snitzer
2008-02-04  9:14     ` Luben Tuikov
2008-02-06 21:54       ` [PATCH 1/1] aacraid: do not set valid bit in sense information Salyzyn, Mark
2008-02-06 22:19         ` Luben Tuikov
2008-02-04  9:11   ` [PATCH] [SCSI] sd: make error handling more robust (v2) Luben Tuikov
2008-02-04 21:22     ` James Bottomley
2008-02-04 23:23       ` Luben Tuikov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.