浏览代码

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.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Tejun Heo 18 年之前
父节点
当前提交
8270bec400
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      drivers/ata/libata-core.c

+ 4 - 0
drivers/ata/libata-core.c

@@ -3705,6 +3705,10 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags)
 			       "%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;
 	}