Skip to contentSkip to conversation

scsi_debug: fix false positive logical block reference tag check fail

PATCH New Akinobu Mita 1 participant 2 messages Dec 9, 2013 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_debug: fix false positive logical block reference tag check fail

Reading partially unwritten sectors generates false positive logical block reference tag check failure.

This bug is caused by missing ei_lba increment in loop of dif_verify() when unwritten sector is skipped.

Cc Douglas Gilbert <[email protected]>
Cc "Martin K. Petersen" <[email protected]>
Cc James Bottomley <[email protected]>
---
 drivers/scsi/scsi_debug.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/scsi_debug.c +1 -3
index 2decc64..bdfb9be 100644
@@ -1832,7 +1832,7 @@ static int prot_verify_read(struct scsi_cmnd *SCpnt, sector_t start_sec,
 	struct sd_dif_tuple *sdt;
 	sector_t sector;
 
-	for (i = 0; i < sectors; i++) {
+	for (i = 0; i < sectors; i++, ei_lba++) {
 		int ret;
 
 		sector = start_sec + i;
@@ -1846,8 +1846,6 @@ static int prot_verify_read(struct scsi_cmnd *SCpnt, sector_t start_sec,
 			dif_errors++;
 			return ret;
 		}
-
-		ei_lba++;
 	}
 
 	dif_copy_prot(SCpnt, start_sec, sectors, true);
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 scsi_debug: make pseudo_primary static

It is not necessary to declare pseudo_primary as global, becuase it is only used in scsi_debug.c.

Cc "James E.J. Bottomley" <[email protected]>
Cc Douglas Gilbert <[email protected]>
---
 drivers/scsi/scsi_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_debug.c +1 -1
index bdfb9be..9cd211e 100644
@@ -3246,7 +3246,7 @@ static struct attribute *sdebug_drv_attrs[] = {
 };
 ATTRIBUTE_GROUPS(sdebug_drv);
 
-struct device *pseudo_primary;
+static struct device *pseudo_primary;
 
 static int __init scsi_debug_init(void)
 {
Signature · 1 line
1.8.3.2