Skip to content

Commit

Permalink
libata: fix n_sectors failure handling during revalidation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Aug 23, 2007
1 parent b377fd3 commit 8270bec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 8270bec

Please sign in to comment.