Skip to contentSkip to conversation

libata: fix n_sectors failure handling during revalidation

PATCH Applied Tejun Heo 3 participants 3 messages Aug 15, 2007 – Aug 23, 2007 libata

lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 libata: fix n_sectors failure handling during revalidation

If revalidation fails because device has different n_sectors after configuration the original n_sectors should be restored before failing revalidation. Without this fix, n_sectors difference will incorrectly and silently pass revalidation when revalidation is retried.

---
 drivers/ata/libata-core.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/ata/libata-core.c +4 -0
Index: work/drivers/ata/libata-core.c
===================================================================
@@ -3705,6 +3705,10 @@ int ata_dev_revalidate(struct ata_device
 			       "%llu != %llu\n",
 			       (unsigned long long)n_sectors,
 			       (unsigned long long)dev->n_sectors);
+
+		/* restore original n_sectors */
+		dev->n_sectors = n_sectors;
+
 		rc = -ENODEV;
 		goto fail;
 	}
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Thu, 16 Aug 2007 03:02:22 +0900 Tejun Heo <[email protected]> wrote:

If revalidation fails because device has different n_sectors after configuration the original n_sectors should be restored before failing revalidation. Without this fix, n_sectors difference will incorrectly and silently pass revalidation when revalidation is retried.

Eeep

Applied
#2 lore raw
In reply to Tejun Heo
Quoted 9 lines · Tejun Heo

If revalidation fails because device has different n_sectors after configuration the original n_sectors should be restored before failing revalidation. Without this fix, n_sectors difference will incorrectly and silently pass revalidation when revalidation is retried.

---
 drivers/ata/libata-core.c |    4 ++++
 1 file changed, 4 insertions(+)

applied